In a brief there are two basic methods used in Auto Focus systems
1. Active Focus: This system is is the least expensive to implement. Basically, it uses a high frequence voice (sonar) or today typically an infrared beam to measure the distance to the subject and then focuses according to the correct settings for that distance. The movement of the lenses is done by an electric motor.
2. Passive Focus System: This type of system employs mechanisms that detect contrast in the field of view. Passive focus works by the camera adjusting the lens until it detects that the highest level of contrast has been achieved. Some difficulties may appear if teh subject is not contrasty enough and there is less noticeable change from one part of a picture to the other.
Cameras with automatic focusing systems usually measure the distance to the center of a view. This method, however, is inaccurate when the object of interest is not at the center. Measuring more than one distance is an approach that may solve this problem. Then the system have to include some kind of program to determine which of the measurements are the most accurate for desired end result.
Image Based Auto-Focusing is trying to find a solution using Artificial Intelligence to determine a problem for a photographer.
In Digital Cameras Autofocusing is slightly easier to carry out because the indicators are already there in the CCD.
It is also very important to understand that, because, physically, there can only be one sharpest distance from the lens to certain points of an object the amount of the "correct" alternatives is numerous or maybe more.