Special tools take the pain out of compiling and installing custom kernels.
Debian boasts some very useful tools to make the job of building and installing kernels much easier, and of course those same tools are available in Ubuntu as well. They streamline the process of compiling a custom kernel and building a .deb package around it, allowing you to install a new kernel the same way you would any other package. This makes it possible to build a kernel on one machine and then just install the package on other machines, without having to recompile or track down all the loose ends—great if you need to upgrade a number of similar machines!
To build a custom kernel "the Ubuntu way," you will need to get hold of the kernel source and a variety of tools to configure, compile, and package it.
You can get the official kernel source yourself directly from http://ftp.kernel.org/pub/linux/kernel/, or a mirror if you like, but of course there are also packages of the kernel source. A quick:
apt-cache search linux-source
will get you a list of Linux kernel source packages all ready to go. Picking one as an example, you could just run:
sudo apt-get install linux-source-2.6.15
to download the source to your system. You'll then end up with an archive sitting in /usr/src, which is where most kernel work is done. Now you can extract the source package:
sudo tar -xjf linux-source-2.6.15.tar.bz2
That will leave you with a /usr/src/linux-source-2.6.15 ...