How does an optical mouse detect movement?
The optical mouse has a chip that has a lo-res camera in it, with a DSP. The DSP picks off certain high-contrast bits of the image in one frame, and looks at how they've tracked across the field of view in the next image. From this it infers X and Y motion, and reports the position change to the computer through a USB interface. The LED provides illumination to increase contrast on the surface, so there will be more bright spots the DSP can pick off.