Sometimes, particularly when doing an eye exam on a small child the optometrist will focus a light in the eye. So what does this do? Such as test is used to help determine the refractive error of your eye, and it's called a retinoscopy exam. Whether you're near or farsighted, or you have astigmatism, examining the way light reflects off your retina is a way your eye doctor can see whether you need eyeglasses.
Essentially, what we are doing during the retinoscopy exam is checking to see how your eye can focus. We begin the exam by looking for what's known as the red reflex. The retinoscope aims light into your eye, and a reddish light reflects through your pupil and off your retina. The degree at which the light refracts off your retina, also called your focal length, is exactly what lets us know how well your eye can focus. If it becomes clear that you aren't focusing well, we hold up a variety of lenses with varying prescriptions in front of the eye to see which one rectifies the error. That lens power is the prescription you require to fix your vision with glasses or contact lenses.
All this happens in a darkened room. To make your eyes easier to examine, you'll usually be instructed to look at an object behind the doctor. Because a retinoscopy exam doesn't require you to read eye charts, it's also a particularly useful way to determine an accurate prescription for kids who might struggle with speech, or others who might be speech-impaired.