You compile a kernel for a couple reasons, a couple of which Fruity touched on.
You can enabled features, being that the linux kernel is modular you have a couple options, you can load a module (say you wanted ISDN support) you could load that as a module or leave it built into the kernel itself. I prefer modules since it allows me to enable certain features when I need them.. sometimes I don't need USB support, sometimes I do
You can also updated the kernel to a new version which may contain bug fixes (which was the case of 2.2 upgrading to 2.4) helped with some nasty IDE controller issues..
The biggest reason however.. you can enable specific optimiszations like support for P4's or Athlon's ect.. most distro's ship with i386 optimized kernels and packages, which guarantee's the most compability with older machines (x386 and up to be specific) but if you have a new machine the optimized code can do a great deal for you since it speeds things up....
for the official how-to.. www.kernel.org
there are different method's for different distro's as well.. in my distro of choice slackware all I have to do is ..
make menuconfig (configure my options)
make dep (configures my kernel dependencies and module dependcies)
make (builds my kernel)
make install (installs my new kernel)
make modules (builds my new modules and keeps the old one's if I chose to do that)
make modules_install (installs my modules)