Electromagnetic radiation in the microwave wavelengths (on the order of millimetres and centimetres) is absorbed by water molecules. The way this happens, simply put, is that energy is transferred from the oscillation of electric and magnetic fields to the mechanical vibration of water molecules. There is a slight charge separation in these molecules, so they behave like small dipoles. Dipoles try to orient themselves with an external field (think of many magnetic needles being swung back and forth when you oscillate a large magnet above them), thus the molecules acquire kinetic energy. Heat, of course, is exactly this motion of molecules.

Since any food has at least some moisture in it, there are always water molecules spread through the stuff we want heated; once these molecules begin to move, they will begin to collide with other molecules (not necessarily water), spreading the heat more evenly by convection. This is why microwave oven manuals often advise you to apply the oven for a certain period, and then leave the food for a while longer (for the heat to spread). Since the microwaves are not blocked by other substances in the food (only metal is likely to reflect them) they go right through it, heating any part with some moisture (usually everywhere, but you might note one ingredient heats upmore rapidly than another). Radiation not immediately absorbed is just reflected from the interior surface (sheets of metal, or even just a metallic web with holes smaller than the wavelength used), until eventually it hits water. If you don't have any water (say you're nuking a pebble) or there's a lot of metal reflecting the radiation away, then the microwaves won't be absorbed, probably overloading the magnetron inside, with unpleasant consequences for the device (and possibly innocent bystanders). If this happens to you, it's probably because you didn't RTFM, or you just don't care.

An interesting consequence of the way the microwave oven heats water, is that you can superheat water, heating it "beyond the boiling point". If you heat water in the microwave for long enough (but not until you see it boil) it will be in this state. The water will be quite still. If you then drop in a spoon or sprinkle some powder in, it will suddenly boil over. You might see this happen when heating a drink... Normally, the heat energy of a molecule divides "equally" between its several forms of kinetic energy. This should be more properly adressed in thermodynamics, but the point is there's a constant stable relation between the energy of a water molecule's oscillation, and the energy arising from its velocity (motion of the centre of mass). Except that if you quickly give the water molecules energy by vibrating them (in a microwave oven), it takes them quite a while to spread the energy out to other forms (e.g. velocity), which happens through numerous collisions. Since the phenomenon of boiling or evaporation is caused by molecules moving fast enough to break free of their neighbours, this will not occur for a while. Since the molecules are still there, they continue to acquire energy. If you then disturb the water somehow, the collisions are made more likely, and the excess energy is quickly distributed.