CyanogenMod is a free, community built, aftermarket firmware distribution of Android , which is designed to increase performance and reliability over stock Android for your device.

CyanogenMod is based on the Android Open Source Project with extra contributions from many people within the Android community. It can be used without any need to have any Google application installed. You will need to provide your own Google Applications package (gapps). CyanogenMod does still include various hardware-specific code, which is also slowly being open-sourced anyway.

If you are coming from a different ROM, data/factory reset is mandatory. If you are flashing over a previous CM build, cache wipe will be sufficient.
You will need to flash the latest recovery ( CWM or TWRP ) mentioned above for a successful flash.
A nandroid backup is recommended prior to flashing CM in case you get into problems.

Reboot to bootloader mode. It is achieved by pressing volume down + power button. Or if you have the android SDK installed, you can also type "adb reboot bootloader" without the quotes in a terminal. It will take you to the bootloader mode. Make sure USB debugging is activated on your phone and your phone is connected to PC. You will also get a popup on your phone. Tick the check box and accept it.

Open Odin and place your recovery.tar / recovery.tar.md5 file under PDA and flash. Keep the phone in your hand before you click flash because the phone will reboot as soon as the flash is over. When you feel the phone vibrate after rebooting, press and hold the volume up button. It will take you to the recovery you installed. You can also untick "auto reboot" in Odin and manually reboot to recovery after the flash. But make sure you reboot to recovery first after the flash.