Mostly it is just the caps that get filthy, so I remove them and let them soak for a few hours under room temperature water with some dishwasher liquid. A few swipes with a cloth does it for the base.
If I need to clean the insides, I use some canned air spray.
If it is not water resistant, you just pull off all the keys and simply clean it up. If it is water resistant(like Logitech K310), you simply wash it in one piece.
If I need to clean the insides, I use some canned air spray.