This article is from the Macintosh hardware FAQ, by Elliotte Rusty Harold firstname.lastname@example.org with numerous contributions by others.
I don't advise taking a Mac apart just to clean it; but if you've
already dismantled it as part of another upgrade or repair, blowing
accumulated dust away with a can of compressed air won't hurt. You
can also use a specially designed computer vacuum cleaner, but don't
use a normal hand vac like a Dustbuster as there's a small chance of
damage to your Mac from the static electricity it builds up.
On the other hand if during one of those late night football games
through the halls of your office someone drop-kicked a half-full can
of Mountain Dew straight through the uprights of your cubicle onto
your Mac (or if you've spilled a soda or some other messy substance
into the Mac in some less creative fashion), you will need to clean
it out. Unplug the Mac and let it sit for at least an hour. It is
essential to give all the parts of your Mac time to discharge since
you'll be cleaning it with water. Take the Mac apart as described in
the next section. Then clean it with lukewarm tap water. Use a soft
toothbrush to clean anything that doesn't come off with water alone.
Let the disassembled Mac air dry for a couple of days, (Don't even
think about using a hair dryer.) and then put it back together.