The mouse camera has a lens that is extremely near-sighted - its focus is mere millimeters: it is looking at small details of the surface you're scanning. How those details move from frame-to-frame give the motion result that is given back to your computer.
When you move the mouse away from the surface, it sees an image so extremely blurred that no details are available for its image processing. It can see light, but it appears the same brightness for every pixel in its tiny frame. No motion is detected.
Any light source can cast a shadow (perhaps from the edge of the mouse's shell bottom where the camera opening resides). As this shadow moves across the frame, your mouse may momentarily see it as a "detail-that-moves" and detect that as motion.
There is really nothing special about the red LED light source in the mouse. It is just a steady source of light to illuminate the surface where the camera is looking. It might change intensity to adapt to surfaces of different reflectivity.
1There is a tiny camera in the mouse. You can confuse it as it is not designed to work with such a conditions. The "tubelight" spectrum may very well contain the light the camera is sensitive to. – Eugene Sh. – 2018-12-19T14:54:11.467
Torch = flashlight, right? Or did an open flame make the mouse move? And tube light = fluorescent bulb, like a long 3ft-4ft straight tube, or smaller one? – Xen2050 – 2018-12-28T03:59:40.670