Starting at the top of your guitar is the headstock. These come in various shapes and sizes depending on manufacturer and guitar model. They serve one main purpose, holding the machine heads, also known as tuning pegs, that are used to adjust the tension of your strings.
Right below the head and often overlooked is the nut. The nut is a small piece of medium to hard material where the headstock meets the fretboard. The nut has grooves cut into to guide your strings down the fretboard from the bridge.
There are two main kinds of nut on a guitar, locking and non locking. Non-locking are the more popular kind of nut and can be found on most fixed bridge guitars, locking nuts are found on guitars with tremolo bridges. Information on the differences between fixed and tremolo bridges can be found in the bridge section of the site.
Gibson Flying V Headstock
ESP EC Headstock
ESP "Slant" Headstock
Paul Reed Smith Headstock