All lenses must be focused to present a sharp image. At the point of focus, the light rays emanating from any point on the subject are brought back together again as a single point in the resulting image—or as close as possible to a single point. Rays of light (photons) leave the subject in many directions. A few of them strike the lens. The wider the lens aperture, the more of them the lens can collect. Then the job of the curved surface of the lens is to nudge the photons in a new direction. The curve of the lens varies the nudging for the different angles at which the photons left the subject. The problem is that once the lens nudges the photons, they keep traveling straight. The photons from any given point will converge on a point at a distance from the lens. At greater or lesser distances than the point at which they all meet, they may be close together but are still spread apart in the shape of the aperture. When you focus a lens, you move the lens closer to or farther from the film or image sensor to make the distance proper. Only when the lens is set properly will the image be sharp or "in focus."
You might think that you'd be able to set the focus once and forget it. Light, alas, isn't so cooperative. Proper focus depends on the distance between subject to lens and lens to image sensor. When one changes, you have to change the other to keep the image sharp. You and your camera must compensate for the different distances between the camera and its subject by "focusing" the lens. Conventional focusing, the traditional way, is to move the lens closer to or farther from the image sensor—when you focus on a more distant image, the front of the image may extend. A more modern technique is internal focusing, which alters elements within the lens to change its focusing distance by changing the power of the lens. Either technique works. It's the lens designer's choice.
From a more practical standpoint, the means by which the focus gets changed is more important. Three different types of focusing systems are possible, and all are used on digital cameras. These include fixed focus, manual focus, and auto-focus.
Fixed focus actually means no focusing at all. The distance between lens and sensor is physically fixed. Nothing moves. That's good because there's nothing for you to adjust. But it's bad, too, because a fixed-focus lens creates a sharp image at only one distance from its subject. Everything else (and often just plain everything) is a bit bleary, out of focus.
Although this situation would seem highly undesirable and even unacceptable in a camera, fixed focus often works and is popular in inexpensive cameras. Fixed focus works best when its shortcomings are hidden by other shortcomings in the camera system. If a lens never produces a truly sharp image, you'll never be able to tell when it is out of focus. If an image sensor only produces 320-by-240 pixel resolution, any loss of sharpness may be lost in the jaggies of the big pixels. Consequently, the limitations of inexpensive lenses cover up the lack of true focus.
The fixed-focus system takes advantage of another optical property. Wide-angle lenses make focusing less critical, so most fixed-focus lenses are a bit wider than "normal." In addition, a smaller aperture makes focusing less critical, so fixed focus lens have relatively small apertures and work only outdoors or with flash.
A manual focus camera puts you in charge. Typically you twist the lens to move it closer to or farther from the film to compensate for subjects at different distances. The twist gives you finer control compared to sliding the lens directly like a trombone. You have to monitor sharpness by eye, either through the viewfinder or display screen. It's not always easy to do (especially in dim lighting).
Although most cameras use auto-focusing (discussed next) to relieve you of the chore, sometimes manual focusing can be preferable. Manual focusing lets you control the "look" of the image so you can exploit techniques such as selective focus or intentional blurring. You can also use manual focus when auto-focusing fails. Although mid-range auto-focusing cameras may not offer you the manual option, you'll want to look for the option if you're serious about photography.
And auto-focus systems are more reliable. They do not forget to focus the camera before that once-in-a-lifetime shot.
Auto-focus systems come in either of two types: passive or active. Passive auto-focus systems look at a scene and attempt to figure out what the correct focus is by making edges as sharp as possible. Active auto-focus systems work like radar or sonar. They send out a signal, usually infrared, watch for its reflections, and judge from the time elapsed between transmission and reception how far the signal has traveled.
Both sorts of auto-focus achieve their intended purpose, at least most of the time. Active systems can be fooled more easily, however. With sonar-based systems, for example, when your subject is behind a window, the sound waves from the sonar system bounce off the glass rather than the subject. As a result, the camera focuses on the window and leaves the subject a blur. Moreover, active auto-focus systems have a finite range. The sound or light they send out is effective only for a limited distance. For normal length lenses, that distance is the equivalent of infinity focus, so this shortcoming poses no problem. With long telephoto lenses, however, the active auto-focus system may run out of range before the lens.
Passive auto-focus systems work like the human visual system by trying to make lines sharp. To do so, the passive auto-focus system requires something to focus on, a subject with a definite outline in high contrast. Without adequate image contrast, the passive auto-focus system won't work. It is particularly susceptible to darkness because low light levels usually reduce contrast (less light means less overall range in brightness, which means less contrast). Passive systems don't work at all in the dark. Active systems have no problem with darkness.
Most auto-focus systems for cameras don't bring objects into absolute focus. Rather, they have a stepped focus system that adjusts the lens to accommodate a range of distances for the subject. Cameras may have as few as three focus ranges or steps. More is better, but infinity is unnecessary.