Place favicon.ico file in root directory of your web host (public_html or www) and add following code into head section of your web page.
<link rel="Shortcut icon" href="/favicon.ico">
<link rel="icon" href="http://www.url/favicon.ico" type="images/x-icon" />
How To Create .ico file?
I create it using my Adobe Photoshop. I have icoformat plugin file which I add in adobe photoshop plugins for having an option of save as .ico file.
Path to add plugin
In my case
C:\Program Files\Adobe\Adobe Photoshop CS3\Plug-Ins\Extensions
Place there icoformat plugin file and while saving file photoshop will offer option of saving as .ico file. We usually create 16×16 px file for icon and save as filename.ico.