Step 1: Research your options
For a reflective sensor a disc with alternating black and white segments is attached to the motor or somewhere along the drive train. An LED (red or infra-red) shines a light onto the disc and a photodiode or phototransistor detects the difference between the light and dark segments by the amount of LED light reflected as the motor turns.
For an transmissive sensor a similar arrangement is used, but the LED shines directly at the photosensor. An opaque vane attached to the motor or gear train (or a hole drilled in one of the gears) breaks the beam, allowing the sensor to detect one revolution.
I will add links to a few examples of these later. This project used the transmissive sensor design, but I tried several variations, as you will see.