Virtually all modern cameras are capable of autofocusing. This means, in practice, that they possess electro-mechanical devices that focus the lens and detect when one or more areas of interest are in focus. Nikon DSLR cameras allow you to select between single-shot and continuous autofocus. In both modes, autofocus is activated when you press the shutter release button halfway. In the first mode, the camera autofocuses first, and allows you to shoot only after it has locked focus onto the subject. If you press the shutter button while the camera is still focusing, nothing happens until the camera locks focus. In the second mode, the camera shoots as soon as you press the shutter button, even if it has not locked focus. There are other differences between the two autofocus modes, but they are not discussed here.
In SLR and DSLR cameras, autofocus employs both electronic and electromechanical devices. The electromechanical focusing devices (motors and gears) are located either in the camera body or in the lens (or both), while the electronic ones (mainly focus detectors and data processing circuits) are always located in the camera body.
The type of autofocus contained in the camera body is usually called mechanical, and the type contained in the lens electronic. However, both systems consist of an electronic part (always in the camera) and an electromechanical one contained either in the camera and lens, or in the lens alone. From the point of view of the user, the real difference is that the first system has a mechanical autofocus coupling between body and lens, while the second has a coupling that consists of a set of electric autofocus contacts. I am also using the traditional names to distinguish between the two types of autofocus, but keep in mind that they refer to the coupling between camera and lens, not to the autofocus system as a whole.
This type of autofocus relies on a coupling located on the camera bayonet, which looks like a small screwdriver. Lenses have a corresponding slotted socket to accept the screwdriver. The screwdriver is spring-loaded, so it retracts when the lens is mounted. If the lens has no slotted socket, the screwdriver stays retracted. If there is a socket, the screwdriver may on may not slot into it when the lens is mounted, depending on the reciprocal orientation of screwdriver head and slot. In the latter case, when the autofocus is activated for the first time after changing lenses, the screwdriver will turn until it fits into the slot with an audible click. This sound is perfectly normal. Because of the reason just mentioned, you may or may not hear the click when autofocusing the first time after changing a lens. Also this is perfectly normal.
Pressing the lens release button on the camera body also retracts the screwdriver from its slotted socket on the lens, thus allowing the lens bayonet to turn freely.
Screwdriver autofocus is simple and reliable. The camera body does everything, and the lens contains only a few gears and cams. One of the disadvantages of this system is that the size of the autofocus motor is a compromise between its strength, energy consumption and weight, based on a range of commonly used lenses. Unusually large lenses, like big telephotos and zooms, are likely to put a strain on this motor, and therefore employ gears that reduce the effective speed of autofocus.
Another disadvantage is that turning to manual focus requires you to disengage the screwdriver first. This can be done with a dial on the camera body (which retracts the screwdriver and deactivates the autofocus motor). At this point, the focus ring on the lens can be turned freely. However, turning the focus ring still turns also the internal gears, which cause a slight noise and offer some resistance to turning, making manual focus less smooth than with a lens with fully manual focus or electronic autofocus. Several lenses with mechanical autofocus possess a button or ring to disengage the focusing ring completely from the autofocus gears.
In the best lenses with mechanical autofocus (e.g., Micro Nikkor 60 mm and the older Micro Nikkor 105 mm), the ring that switches between manual focus and autofocus also engages or disengages the manual focus ring, so that you will not accidentally hold it when autofocusing and block the autofocus motor, or try to force it by focusing manually. This could damage the autofocus mechanism. Several lenses (especially cheaper ones, including both Nikkor and third-party) do not disengage the focus ring, and it is up to you to remember not to hold or turn the focus ring with your hand while autofocusing. This is a major source of potential damage to both your camera and lens (although you will get away with forgetting this once in a while).
Since the autofocus motor is in the camera body, different camera models can, and do, have motors of different strength and speed. As a rule, professional and semi-professional bodies have stronger and faster motors than consumer models. This affects the speed of autofocus: with the same lens, a professional or semi-professional body almost invariably autofocuses faster than a consumer one. Since a lens includes gears to transmit mechanical autofocus to the focus mechanism, different lens models can have very different autofocus speeds, even with the same camera. In general, lenses that must move heavy groups of lenses in order to focus will have a low autofocus speed. Therefore, lenses with internal or back focusing, as a rule, autofocus faster than those that must move the whole lens back and forth. This is especially true of large zooms and telephoto lenses.
Electronic autofocus uses a motor in the lens barrel. Usually, this is a "silent" motor that emits ultrasound noise instead of audible noise. In some lens models, however, this motor is quite noisy. The motor is powered and controlled by the camera body through a set of electrical contacts near the lens mount. Additional contacts are used for extra functions (mainly power, exposure and, when present, vibration reduction). Lenses for Nikon cameras may have a variable number of contacts. If a lens has two "missing" contacts, leaving a larger gap between a pair of contacts (above example, at the left), the lens does not have electronic autofocus. If there is no gap and the number of contacts is higher, the lens usually has it.
Ultrasonic electronic autofocus is called AF-I or AF-S by Nikon, and HSM by Sigma. Other third-party manufacturers of lenses for Nikon cameras produce only lenses with screwdriver autofocus.
Electronic autofocus has several advantages. It is silent, at least to the photographer's ears (many animals can hear in the ultrasound range, so it is an open question whether it is silent also for them) and usually faster and more precise than mechanical autofocus. For applications like sports or birds in flight, electronic autofocus is almost a must. Unlike mechanical autofocus, which is basically one-size-fits-all, it can be optimized for a particular lens. In addition, most lenses with electronic autofocus also allow you to turn the focus ring without disengaging the autofocus if you want to adjust the focus manually. It all adds up to faster and more comfortable use.
While different camera models may have a different set of sensors and algorithms for computing the best autofocus position, the motor and gears of lenses with electronic autofocus are in the lens. Therefore, autofocus speed with electronic autofocus is largely independent of which camera body you are using.