Accidents happen. Whatever you were drinking, some of it ended up on your mechanical or membrane keyboard. Here's what you need to do to prevent dead keys or an entirely dead keyboard:
DON'T: Put it in rice
A common belief has been to put wet technology into rice to get rid of the moisture – but you actually should not do that, as it just introduces moist starch particles to the mess.
DO: Unplug it ASAP
Unplug the USB it to cut the power (or remove the batteries if it's a wireless keyboard).
DO: Flip it over
Prevent additional liquid from seeping down into the keyboard by flipping it over until the liquid stops dripping from it. Ideally, leave it flipped over for 24 hours to dry.
DON'T: Use a paper towel
Just like avoiding rice, avoid using paper towels, tissues, or anything that will introduce further dust and debris to your wet keyboard.
DO: Use a lint-free cloth
This will help avoid adding unneccesary dust and debris to the keyboard.
DO: Carefully disassemble the keys
If your keys are sticky or sticking after they're dry, carefully remove the membrane or mechanical keycaps in and around the affected area. Use a keycap puller if you have one. Rinse any sticky keycaps with warm water or an alcohol swab. Be sure to take a picture or keep the keycaps in order, so you can easily reassemble them.
DO: Disassemble further if keys are still not working
If keys are acting up, you might need to unscrew your keyboard and try to dry out any moisture that seeped further in. If this still doesn't work, you might be running out of options aside from taking it into a shop or replacing it entirely.
DO: Consider a water-resistant keyboard
If all else fails and your keyboard gets fried, all you can do now is ensure that you don't make the same mistake twice.
An IP32 water-resistent keyboard like the Apex 3 has enclosed circuits and built-in drainage channels, so you can rest assured that a spill won't end your keyboard ever again.