Surnames
What we understand a surname to be is the hereditary name we bear along with other members of our family, usually inherited from our father and persisting from one generation to the next.
This is the most common form of surname in Western Europe, America and Australia, but it is not the only form. In Iceland, there are still no hereditary surnames: if your father is Michael and you're Martin, then your name is Martin Michaelson. If you have a son called Peter, his name is Peter Martinson. Each name lasts only a single generation.
How surnames began
In Europe, the adoption of hereditary surnames began in the Middle Ages, over the period between about 900 and about 1300 and continued at very different paces in different locations. In Wales, up to the mid 1800s, most people in rural areas used single-generation patronymics, as in Iceland. In Turkey, people were required to use a surname only from 1934.
Initially, surnames were common only among the aristocracy. With literacy and the broadening of government record-keeping, the practice slowly spread among other classes. In urban areas, at least, most surnames were fixed and hereditary by the 1700s.
In Ireland
Ireland was one of the first places in Europe to adopt hereditary surnames, with some evidence of persistence from around the early 900s. The reason is simple. Medieval Irish society was organised around the extended family. Who you were related to determined what you could own, what work you could do, who you fought with and against … Hereditary patronymic surnames were wonderful badges of allegiance, showing everyone immediately who 'your people' were.
In the rest of Europe, surnames could be locational - Leonardo da Vinci, 'Leonard from Vinci' - occupational - Baker, Smith, Thatcher - or derived from descriptive nicknames - Belcher, Little, Short. But in Ireland almost all surnames were patronymic, using Mac 'son of' or Ó 'grandson of'.
Surname adoption here was not static. For more than six centuries, there were explosive waves of surname-creation, with great networks of extended family names budding and sub-budding off central stems as families grew or waned in importance. For example, the grandchildren of Brian Ború (d. 1014) understandably wanted to flag their connection and started the surname O'Brian (Ó Briain). But the sons of one of those grandchildren, Mathghamha Ua Briain, picked their own father as a starting point and became (in modern Irish) Mac Mathúna, McMahon. Four generations later, Constantine (Consaidín) O'Brien, bishop of Killaloe, was the source of the Mac Consaidín line, the Considines.
Into the middle of this in the mid 1100s came the Normans, who as yet had no hereditary surnames themselves. They took up the Irish practice with relish. The De Burgo family, who acquired most of Connacht for themselves, spun off dozens of modern names: (Mc)Davey, (Mc)Davitt, (Mc)Doak, (Mc)Nicholas (Mc)Philbin, McRedmond . all stemming from the forenames of prominent de Burgos, and all following precisely the Gaelic Irish tradition.