The flash catches light returning from the retina

In dim light, the pupils widen to let more light into the eye. A camera flash can pass through those enlarged openings, travel through the clear structures inside the eye, and reach the retina—the light-sensitive layer lining the back of the eyeball.

The retina contains many blood vessels. When flash light reflects back from this blood-rich tissue, some of it exits through the pupil and reaches the camera. The camera records that returning light as a red glow.

Why the effect varies

Red-eye is most likely when the flash sits close to the camera lens. From nearly the same angle, the camera can catch light traveling back out of the eyes. A flash farther to the side sends the return reflection away from the lens, making the effect less likely. Bright surroundings also make pupils smaller, narrowing the opening through which flash light can enter and return.

The red appearance is not the eye itself glowing: it is reflected flash light, colored by what the camera sees inside the eye. That is why shifting the flash or turning on the room lights can change the result without changing anyone’s eyes.