What's the best way to get ants out of laptop keyboards?
First determine the species of ant. It can't be soldier ants or driver ants for example since these are nomadic. Likewise, weaver ants make nests from the leaves in trees and so are unlikely to have occupied a laptop keyboard. Pharaoh ants are a likely candidate, being small (2mm) and common in human buildings. If they're yellow crazy ants then be careful of touching your eyes with your fingers as formic acid can cause blindness.
Ants' compound eyes have specialised cells that can detect polarized light, so it is possible that the ants have become disoriented by the polarized light from your laptop screen. You could counteract this by using an external CRT monitor for a while, until the ants have moved on.
If it's an established nest the queen may have constructed a sizeable brood chamber, which is likely to be situated under the space bar or the enter key. Pharaoh ants have more than one queen though (unlike the popular image of a single queen), so the caps lock and backspace keys might also be concealing chambers, be sure to check those.
Foraging ants travel up to 200m from the nest, often navigating by counting the number of steps they have taken. An improvised small scale treadmill (moving a piece of paper) will often be sufficient to confuse them sufficiently to persuade them to move on, or to induce an ant mill.
Tease them out with bait. They're very fond of chopped liver.
Don't drop food or drink on your laptop. A vacuum would probably be a great way to get crumbs out, but you might need to call an exterminator like Orkin to get it handled professionally. =P
Seriously though, you'll need to open up your laptop and vacuum out the crumbs; in the future, don't eat food over your keyboard -- crumbs drop in, the food goes bad, and then the scouting ants will detect it and find it. After the scouts return to the nest with the good news of the newly discovered food source, they'll send in the army.
Okay, everybody sing with us now ... the ants come marching in...
Depending on how bad the infestation is one of these techniques may work for you:
-
Vacuum cleaner
If there are just a few ants hidden in and around the keys a vacuum cleaner may well be able to suck them out. It is sometimes a good idea to stretch a cut-off section of an old pair of nylon stockings over the end of the vacuum tube to prevent any loose keys from getting sucked up into the vacuum bag.
-
Dismantle and clean
If the infestation is quite bad you will have to dismantle the laptop and clean it thoroughly. A soft paintbrush can be used to coax the ants out of corners and from in between IC pins etc. Take care when doing this to keep track of all the screws and components, and wear an anti-static wrist strap at all times.