So many COTS FIRST gearboxes from andymark and VEX have built in spots for encoder attachment and have mounting kits for them as well.
Alternatively, you can attach one of these
http://www.andymark.com/encoder-p/am-3314.htm directly to a CIM shaft if you're not using one of those COTS gearboxes.
Those are your two best COTS, slap on to gearboxes/CIM option.
If you feel that your specific setup needs a more custom solution, provide more info and we can have a more in depth discussion about how encoders work and how to fit them into your system.