Headstock or peghead is a part of guitar or similar stringed instrument. The main function of a headstock is holding the instrument's strings. Strings go from the bridge past the nut and are usually fixed on machine heads on headstock. Machine heads are used to tune the guitar by adjusting the tension of strings and, consequentially, the pitch of sound they produce.
Two traditional layouts of tuners are called "3+3" (3 top tuners and 3 bottom ones) and "6 in line" tuners, though many other combinations are known, especially for bass guitars and non-6-string guitars. When there are no machine heads (i.e. tuners are not needed or located in some other place, for example, on guitar body), the guitar headstock may be missing completely, as in Steinberger guitar or some Chapman stick models.
The headstock may be carved separately and glued to neck using some sort of joint (such as scarf joint). There are two major trends in headstock construction, based on how the string will go after passing the nut. The advantages and disadvantages of both trends are very debatable and subjective, so these two variants are used:
Luthiers of both styles frequently cite better sound, longer sustain and strings staying in tune longer as advantages of each style. Fragile construction is cited as a disadvantage of each style too: single piece necks are more likely to break on occasional hit and are harder to repair, while glued-in necks can break with time.
Apart from its main function, the headstock is an important decorative detail of a guitar. It is the place where overwhelming majority of guitar manufacturers draw their logo. Some guitars without machine heads (for example, ones equipped with Floyd Rose SpeedLoader) have a headstock for purely decorative reasons.
All major guitar brands have signature headstocks that make their guitars or guitar series easily recognizable. An unwritten ethic law of the guitar industry allows copying of overall guitar body designs, but no major brand copies headstock designs. As seen in a section below, even "copied" at the first glance designs retain clear visible changes in dimensions, proportions of elements, etc, so it is almost always possible to tell a major brand of a guitar by looking at headstock.