Restart automatically if the computer freezes
The Mac models that support this have a secondary processor, independent of the CPU (it's the LOM on Intel Xserves, SMC on regular Macs).  Basically, the secondary processor can have a countdown timer set up, and reset the CPU (forcing a reboot) if the counter hits 0.  Meanwhile, a process running within OS X (originally it was a program called watchdog, but I think launchd handles it now) resets the counter periodically.

If the OS ever gets hosed enough that launchd/watchdog/whatever fails to reset the counter within the time limit, the LOM/SMC/etc takes over and forces a reboot.

BTW, regarding @TJ Luoma's comment on kernel panics: when a panic occurs, the OS is basically dead.  There's no way for launchd to be notified of this, because it's dead along with everything else.  What happens is that some information about the panic gets stuffed into NVRAM (the surviving shreds of the OS can access that without needing drivers, etc, which all went away in the panic).  After reboot, the NVRAM is checked and (if appropriate) its contents are reported in the panic log.