Autofocus Systems
Autofocus is a system. There is no single part that is particularly responsible for making an AF system perform well or achieve high accuracy. In modern cameras, components and software that support AF are found in both the lens and the camera body. In some cameras that are still based on legacy AF systems, these components may be inferior, even significantly inferior, to modern fully electronic AF systems.
From a general standpoint, electronic autofocus systems where the motor is housed in the lens provide the greatest performance and highest accuracy. However an AF lens with a focus motor is only part of the picture...you still need a something to drive that motor and make it do its thing. There are also different kinds of motors, some are cheaper and less effective while others are more expensive and more effective. In addition to mechanical and electrical components, you also need appropriate software...firmware, to operate an AF system. In a modern electronic AF system, firmware usually exists in both the lens and the camera body. In older systems, firmware will likely only exist in the camera body (potentially along with the AF drive motor, as some older designs included the motor in the camera body rather than in the lens.)
Autofocus Operation
Autofocus in the past used to be achieved with partial open-loop feedback systems, where the camera would initiate an AF drive movement, the lens would adjust, and the system would stop until you told it to perform another AF adjustment. Depending on the exact implementations, more than one lens movement may have occurred in response to a single AF command. This may have been due to limited or no firmware in the lens, preventing a proper feedback loop.
In modern AF systems, AF drive is achieved with closed-loop feedback systems. With a closed loop, AF adjustments are continuously performed until focus is achieved...at least to within certain tolerances. This is possible due to much richer firmware housed in autofocus lenses, allowing more complete two-way communication between the lens and the camera. The camera instructs the lens to make a certain move, and the lens can provide information about whether it made the requested move, and whether the move was by the requested amount, or not. The camera and lens can continually make adjustments in response to a single AF command from the user to achieve a more accurate focus.
Such closed-loop feedback is a more recent advent in AF systems, supported by newer lens technology, more advanced AF drive software in camera bodies, and more accurate phase-shift detection sensors. AF speed and accuracy are increasingly dependent upon AF sensor capabilities, the number of AF sensor points, the capabilities of AF drive software, and the speed of in-camera processors.
Autofocus Accuracy
When it comes to accuracy, there are several specific factors that play a role. The AF sensor is probably the most significant factor, however the firmware in the lens as well as the optical quality of the lens also count. Metering systems, particularly color metering systems, are also becoming tied into the AF system of modern cameras, offering increased capabilities not previously possible, or only possible on very high-end cameras. There are a wide variety of AF sensors on the market in current DSLR cameras, from basic 9-point sensors with a single high precision point to 61-point sensor with 41 high precision points, and a variety of options in between. The size of each AF point, their density, the orientation of phase-detect sensor lines, and even how sensor lines converge all affect the precision and accuracy of an AF system.
Naturally, the more complex the AF sensor is and the higher the number of AF points, the more complex the software that drives it must be. In modern "reticular" (net-like) AF systems, where there are a high number of points, as well as a high number of high precision points, the AF drive software is generally pretty advanced. A color metering sensor, either Olive/Teal (Red-Green and Blue-Green) or full RGB, may be involved in AF system decisions, allowing subject color, shape, and even identification based on libraries of known subjects can be used to assist in the selection of which AF points to use when determining focus.
The precision of an AF point depends on its structure. There are single line points, both horizontal and vertical sensors, cross type points, which involve both horizontal and vertical line sensors in a single AF point, and diagonal cross type points which involve two 45 degree line sensors in opposition to each other for a single AF point, and double cross type points that utilize both a standard and diagonal cross type set of sensors at a single AF point. The more line sensors, of any orientation, involved in the detection of phase-shift at a single AF point will increase the precision of focus detected by that point.
The design of each sensor also varies. Some line sensors are extremely high precision as they include more photodiodes per line, allowing phase shift to be detected in finer increments, yet requiring more light to do so. Others are lower precision as they use fewer photodiodes per line, sensing more light per sensor, therefor operating in lower overall light. Some AF points will only operate up to certain maximum apertures. The highest precision points tend to require f/2.8, and there are usually fewer points in an AF system that are this precise. Most AF points will require at least f/4 or f/5.6, operating in less light but also offering less precision. Some advanced AF systems support one or more AF points that will operate with lenses that have an f/8 maximum aperture (such as an f/5.6 lens with a 1.4x TC or an f/4 lens with a 2x TC). Most modern multipoint AF systems have f/2.8, f/4, and f/5.6 AF points, and a few include one or more f/8 AF points.
Autofocus Performance
When it comes to the speed of an AF system, this really boils down to two things: Light and processing performance. In almost all cases, the more light you get down the lens, the faster AF will be. This is due to the fact that an AF unit, a small package below the DSLR mirror that houses the AF sensor, utilizes only a fraction of the light that actually passes through the aperture. The mirror itself is half-silvered, and will allow about 50% of the light that reaches it through to a secondary mirror, which will reflect that 50% of light onto the AF unit. Further, only the area of the frame covered by AF points is actually half-silvered in the main mirror, so only a fraction of the total amount of light is involved in the first place...so were working with less than 50% of the total amount of light passing through the lens aperture. Furthermore, a special lens on top of the AF unit above the sensor is responsible for further dividing the light that reaches it. The light reaching the AF unit will be split by as many AF points, and for each AF point, light will be split again to reach the two, four, or even eight halves of each line sensor responsible for detecting phase shift for each AF point. An AF sensor has to work with less than 50% of the light passing through the lens, and each AF point works with a fraction of that light.
Assuming you have enough light to use the highest precision AF points, the key factor in performance is the efficiency of the AF drive software and the speed of the processor that executes it. An efficient algorithm operating on a fast processor, paired with a high quality lens that also includes a fast processor and efficient algorithms in its own firmware, will produce some of the best AF performance. In the case of the Canon 1D X, the AF and Metering system actually has a dedicated processor that is independent of the core image processors (a unique setup), providing continuous AF with uninterrupted processing power. High performance computing allows an AF system, both lens and camera, to perform closed-loop AF fine tuning several times in a fraction of a second, supporting extremely high precision, high accuracy continuous AF to be performed anywhere from 6 to 14 times per second.