TIMs break down into two basic types. If you've bought a retail processor in the past, you'll probably be familiar with the thermal pad, which is a small square patch of phase-change material (one that changes state from solid to liquid according to temperature). At room temperature, it's solid or semi-solid, but once the CPU warms up, it softens to provide a thin, thermally conductive interface.
The thermal pad is often derided, but it has advantages. It isn't messy, it's pre-applied and it's evenly distributed across the surface, which is why manufacturers like it for their retail heatsinks. It's also less likely to creep in the long term than cheaper pastes.
However, a thermal pad's thermal conductivity usually isn't as good as that of proper TIM, and the pads only work under constant pressure from the heatsink retention clips. If these don't provide enough pressure, the pad is useless. In addition, there can be long-term problems; as the heatsink base and CPU grow or shrink due to heat, the pads don't always keep up, and air pockets can be introduced.
In more recent times, however, as the TDP of processors has increased, thermal pads have been phased out in favour of a form of thermal grease that's screen printed on to the heatsink. This is because the pads were made to become fluid at a certain temperature, but the fluid degrades and starts to separate if the temperature goes above this.
The thermal pad on the bottom of a stock Intel LGA775 heatsink (left), Arctic Alumina tube (right) - Click to enlarge
A paste, meanwhile, comes in a sachet, tube, bottle or syringe containing - at the low end - a silicon-based grease that fills the gaps or - at the higher end - a grease or gel containing suspended particles of one or more substances with a high thermal conductivity. The paste or gel is brushed or scraped over the two surfaces, then, during operation, it flows freely to eliminate gaps (although for gels, there's usually a 'curing' period during which the thermal interface material settles and fills in the gaps). Over time, it hardens to a more permanent, rubbery state.
Gels and greases have their downsides. Firstly, the TIM can pump out of the interface area under heat and pressure. Secondly, over time, the liquid constituents can evaporate, causing hardening, and then cracking or crumbling. Gels and greases are also more prone to poor application.
Whack too much on or don't spread it evenly, and you either get a less efficient heat interface, or create an excess that leaks out and wreaks havoc on the motherboard. Generally speaking, the more viscous the TIM, the more resistant it will be to any ill-effects. Partly for this reason, the early silicon greases are steadily being replaced by polysynthetic oils or gels.