answer:There’s a Wikipedia article on optical mice that explains its workings. A modern optical mouse typically uses a red LED as a light source (less commonly, a laser diode or a blue LED) and has an optical sensor to receive reflected light. When active, the LED flashes at something like 1500 Hertz, appearing bright. It works by comparing successive images using signal-processing software to determine incremental travel. When removed from the surface, it enters a “fallback” or standby power mode, where it only flashes at around 100 Hz or less. This makes it look much less bright. Bringing your finger near the mouse—as you have observed—causes it to enter the active state and brighten. If you don’t move your finger, it reverts to the fallback state after a short time to reduce power consumption.