Motor sub-assembly taken from a broken Canon printer. I've seen several of these opto-tachometers (or position sensors), but I liked this one, especially as it was so easy to test. There are only 4 wires for the sensor which turned out to be +5volts, GND and 2 sensor output wires.
If you look carefully you can just see the plastic disc driven by the motor which has a lot of fine black lines on it which interrupt the beam of light in the sensor. The beam is visible rather than infra-red which is handy because you can see it so that means something is working!
With the motor running and one sensor connected to a multimeter set to measure frequency, I got a steady 6.3kHz and when a bit of resistance was applied (i.e. a finger and thumb) the speed reduced and the frequency with it.
Handily the meter also reads duty cycle (ON/OFF ratio of the pulses) and I got 49.5%; almost 50/50 cycles. Interestingly on the other sensor wire I got... 51.5% as would be expected so I'm guessing the 2 sensors could be used to detect direction or something.
Classic use for this would be to drive the motor using a PWM (pulse wave modulation) output through a big transistor or a purpose-designed drive chip. This gives speed control by adjusting the duty cycle; more ON means faster and less ON means slower, but no stalling. The feedback from the sensor means the speed can be maintained very accurately, jam or stall conditions can be detected and at low (low) speeds even position can be determined, which is what goes on in the printer so that a point on the page can be accurately printed.