Old English negel "tapering metal pin," nægl "fingernail (handnægl), toenail," from Proto-Germanic *naglaz (source also of Old Norse nagl "fingernail," nagli "metal nail;" Old Saxon and Old High German nagel, Old Frisian neil, Middle Dutch naghel, Dutch nagel, German Nagel "fingernail; small metal spike"), from PIE root *(o)nogh "nail of the finger or toe" (source also of Greek onyx "claw, fingernail;" Latin unguis "fingernail, claw;" Old Church Slavonic noga "foot," noguti "fingernail, claw;" Lithuanian naga "hoof," nagutis "fingernail;" Old Irish ingen, Old Welsh eguin "fingernail, claw").
The "fingernail" sense seems to be the original one, but many figurative uses are from the "small metal spike" sense: hard as nails is from 1828. To hit the nail on the head "say or do just the right thing" is by 1520s; in Middle English driven in the nail (c. 1400) was "to drive home one's point, clinch an argument," and smiten the nail on the hed was "tell the exact truth" (mid-15c.). Phrase on the nail "on the spot, exactly" is from 1590s, of obscure origin; OED says it is not certain it belongs to this sense of nail.
As a unit of English cloth measure (about 2 1/4 inches) from late 14c.; perhaps from a nail being used to mark that length on the end of a yardstick.
word-forming element making nouns meaning "place for, art of, condition of, quantity of," from Middle English -erie, from Latin -arius (see -ary). Also sometimes in modern colloquial use "the collectivity of" or "an example of."
noun suffix, in army, city, country, etc., from Old French -e, Latin -atus, -atum, past participle suffix of certain verbs, which in French came to be used to indicate "employment, office, dignity" (as in duché, clergié).