While there is plenty of information around on creating a favicon for your website, unfortunately most of it is fairly incomplete. Here’s my summary:
While newer browsers support a gif or png image, IE still needs an ico file. There are a few online tools for creating these, but personally I use Microangelo.
I was surprised that IE only uses a favicon (any context) after the site has been bookmarked. Firefox uses it all the time.
Icon files can contain multiple images. I included 16x16, 32x32 and 48x48 pixel images in Windows XP colour (24-bit with 8-bit alpha). At the very least, you need one 16x16 pixel image. There are many more formats you can provide depending on your desired level of support. I wanted it to look good in the browser or in Windows as a shortcut.
There are a few ways to inform the browser about a favicon:
The favicon validator is a great little online service.