Formats and sizes
The classic file is favicon.ico, which can hold several sizes (16, 32, 48 and 64 pixels). Modern pages also link PNG icons, an SVG and a 180 pixel Apple touch icon. Google asks for sizes that are multiples of 48 pixels for search results.
Making one
The Favicon Generator builds a multi-size ICO from any image, and the guide has design tips.
Common misunderstanding
Favicons are cached hard by browsers and search engines, so a new icon can take days to show. Browsers also request /favicon.ico by default, so keep a file at that address.