Machine head

A machine head (also referred to as a tuning machine, tuner, or gear head) is a geared apparatus for tuning stringed musical instruments by adjusting string tension. Machine heads are used on mandolins, guitars, double basses, and others, and are usually located on the instrument's headstock. Other names for guitar tuners include pegs, gears, machines, cranks, knobs, tensioners, and tighteners.
Non-geared tuning devices as used on violins, violas, cellos, lutes, older Flamenco guitars, and ukuleles are known as friction pegs, which hold the string to tension by way of friction caused by their tapered shape and by the string pull created by the tight string. 
Construction and action.
Traditionally, a single machine head consists of a cylinder or capstan, mounted at the center of a pinion gear, a knob or "button" and a worm gear that links them. The capstan has a hole through the far end from the gear, and the string is made to go through that hole, and is wrapped around the capstan. To complete the string installation, the string is tightened by turning the capstan using the tuning knob. The worm gear ensures that the capstan cannot turn without a movement on the knob; it also allows precise tuning.
Banjos usually employ a different mechanism using planetary gears - in this case the knob and the capstan both rotate on the same axis. A few guitars (e.g. the original Gibson Firebird, early Gibson basses and Mario Maccaferri's plastic instruments) have used this design.
The guitarist adjusts the tension of the various strings using the knobs so that they are correctly tuned: a higher tension yields a sharper pitch, a lower tension a flatter pitch. Typical tensions for steel-string acoustic guitars with "light" tension strings are 10.5 kgf (23.3 lbf, 103 N) to 13.8 kgf (30.2 lbf, 135 N).
Varieties.
Several kinds of machine head apparatus exist:
On some guitars, such as those with Floyd Rose bridge, string tuning may be also conducted using "microtuning" tuners incorporated into the guitar bridge.
Likewise, 'headless' guitars and basses, notably those designed by Steinberger and their licensed imitations, such as the Hohner Jack Bass, and unlicensed imitations such as the Washburn Bantam, have the machine heads at the body end. Steinbergers and Hohners require specialist double-ball end strings, whereas the Washburn Bantam can take regular strings.
Presently, most worm-gear tuners provide a gear ratio of 14:1. In older designs, 12:1 was common, and lower ratios as well. Lower ratios allow a replacement string to be brought more quickly up to pitch, though with less precision for fine-tuning. Lower ratios are also more forgiving of imperfect machining, and of factors that might compromise the gear surfaces (corrosion, grit, poor lubrication).
As increased precision of milling became more cost-effective, higher ratios appeared on the market, with 14:1 being the modern standard, trading accuracy against slower initial string winding. More recently, versions with an 18:1 gear ratio are available (particularly from Grover), and the Gotoh 510 offers 21:1.
Locking tuners.
The term "locking tuners" has two meanings. Presently, it refers to some sort of mechanism in the string peg (usually a cam or screw) that locks the string in place, preventing slippage. With the popular increase of extreme vibrato-arm usage in the 1980s, several manufacturers introduced a modified design, commonly called "locking machine heads", where the individual tuner has an additional mechanism to lock the string in place and stabilize tuning, primarily intended for musicians who make regular use of the vibrato. Some designs increase string breakage at the point they grip the string.
The term "locking" is much older, possibly originating with Grover, and refers to an "anti-backlash" design of the gears, which greatly reduced the slippage of the basic worm-and-gear system. The gear's teeth are shaped to lock into those of the worm, with the string tension insufficient to overcome the friction between the gears. Such a design is called self-locking. Grover Rotomatics and similar designs from other manufacturers are rightly called "locking tuners."
Resistance to usage.
Musicians playing certain instruments, most notably the violin family, (excepting the double bass) remain resistant to the use of machine heads, insisting on the continued use of friction pegs. Such factors as appearance, weight, tradition, and simplicity are cited as justification, despite issues with friction pegs slipping out of tune, coming loose, or jamming. In the early 2000s, tuning pegs were introduced with planetary gearing inside a friction-peg shaped casing that can be fitted to an instrument without physical alterations. While reasonably well-accepted, planetary pegs can make string changes more time consuming.