How does the auto red-eye correction work in digital cameras?
There are essentially two ways to remove red eyes with a digital camera:
While taking the picture, contract the subject eye's pupil. This can be done for any camera, not just digital: the flash blinks shortly before taking the actual picture. The main drawback of this technique is that the subject may move or close eyes completely due to the pre-flash(es).
While processing the picture (either on a computer or built-in a camera, see e.g. this article for an example. In this case, the processing algorithm just detects red eyes and replaces the red color with a neutral one like black. The main drawback of this approach is that it may lose the actual color of eyes (for example, if you expect a nice blue iris with a small pupil, you'll get a very narrow iris with a very wide black pupil).
Best is to attack the effect at the source: red eye effect is caused by a source of light close to the camera and pointing directly to the subject. See e.g. How to Avoid Red-Eye in Photos? for techniques to avoid this (bouncing the flash is simple and efficient if you have the right flash for that).
Conventional wisdom about red-eye reduction states that contraction of the pupil is responsible for reducing the amount of red-eye you get to see. Pre-flashes or focus-light action may have some of that effect but a significant part of their work mechanism is attention-catching, causing the eyes to reflexively focus on the light source. Here are two photographs made under equal conditions, with the first focused right on the camera and the second focused to some point significantly before that.
The second image shows significantly more red-eye than the first while the pupil size is not significantly different.
So why the large difference? In the first case, the image of the flash on the retina is sharp and so is the image of the camera lens. They are mostly disjoint, and due to reciprocity, the image of the camera lens is the part of the retina that the camera lens gets to see.
In the second case, the image of the flash on the retina is blurred and so is the image of the camera lens. Since they are pretty close, there is significant overlap and thus what the camera lens gets to see contains a significant amount of the retina lit by the flash.
Try it yourself. Focus on the camera versus some point far from it, either closer or by relaxing your eyes and looking wide.
Of course, an enlarged iris does also increase the "bokeh" on the retina and thus the overlap between flash image and lens image. And of course, separating lens and flash more also separates their more or less blurred images on the retina more.
But catching the visual attention, triggering the focus reflex and thus creating sharp images of camera and flash does a lot for separating what the flash causes in the eye to happen and what the camera lens gets to see.
The multiple flashes of light likely affects both the size of pupils and the direction of gaze.
The pupillary response begins almost immediately upon changes in lighting, but takes longer to complete. It also takes much longer for pupils to fully open than it does for them to constrict. (Shine a light in your eyes while looking in a mirror if you're interested.) The direct response is the change in the pupil through which light is shone. The consensual response is the change in the other pupil. Both eyes should respond equally because neural pathways cross over connecting both eyes to the controlling regions of the brain.
The accommodation reflex is the change in pupil size in response to distance. When doctors check eye movements, they also look for normal pupillary responses. Making you look at your nose is not just because it's fun to make people look cross-eyed.
During a fundal exam, doctors use the red reflex to align the ophthalmoscope during approach. Given the proper angle of approach, the red reflex can still be seen when the pupil is small, but it is more difficult to "lock" onto. That is why dilated eye exams are much easier to perform, but it's still possible to examine the retina without dilation.
Even a small change in the size of the pupil can significantly change the angle at which the red reflex is visible. Notice that the light reflex is located in different positions with respect to your pupils in each of the pictures. Also notice that the size of your pupils in the middle picture is slightly smaller and the red reflex is still present, but less visible.
As for why you can look away from the camera and still have a strongly visible red reflex, not only are your pupils especially dilated in that photo (they look smaller than they are because of the direction in which they are pointed), but there is also a bundle of vessels within the eye that corresponds with the blind spot. This forms the optic disc, which is brighter because of the presence of additional vessels in the area.