Optical mouse
An optical computer mouse uses a light source, typically an LED, and a light detector, such as an array of photodiodes, to detect movement relative to a surface. It is an alternative to the mechanical mouse, which uses moving parts to sense motion.
The earliest optical mice detected movement on pre-printed mousepad surfaces. Whereas modern optical mice work on most opaque reflectively diffuse surfaces like paper, they usually aren't able to detect movement on specularly reflective surfaces like polished stone; coherently-lit (laser) mice can function even on such glossy surfaces, but perform poorly on transparent surfaces; dark field illumination allows mice to function reliably even on glass. Laser diodes are also used for better resolution and precision. Battery-powered wireless optical mice flash the LED intermittently to save power, and only glow steadily when movement is detected.
Mechanical mice
Though not commonly referred to as optical mice, nearly all mechanical mice tracked movement using LEDs and photodiodes to detect when beams of infrared light did and didn't pass through holes in an incremental rotary encoder wheel. Thus the primary distinction of “optical mice” is not their use of optics, but their complete lack of moving parts to track mouse movement, in lieu of an entirely solid-state system.