Sometimes, particularly when performing an eye exam on a small child the eye doctor will direct a light in the eyes. But what does this do? Such as test is used to help determine the refractive error of your eye, and it's known as a retinoscopy exam. Whether you're near or farsighted, or you have astigmatism, examining the way light reflects off your retina is one way your optometrist is able to determine if you need eyeglasses.
In short, what we are doing during a retinoscopy exam is checking how well your eye focuses. We shine light into your eye because we are looking for what we call the red reflex. The retinoscope sends light into your eye, and a red or orange light reflects through your pupil and off your retina. The retinoscope measures your focal length, or in layman's terms, it will determine the angle of refraction of light off your retina which tells us how well your eye focuses. And if it's apparent that you can't focus well, we hold several lenses with varying prescriptions in front of the eye to see which one corrects the error.
All this happens in a dark room. To make your eyes easier to examine, you'll generally be asked to look at something behind the doctor. Because a patient isn't instructed to read eye charts during a retinoscopy exam, it's also a particularly useful way to determine the prescriptions of kids who might struggle with speech, or others who might be speech-impaired.