How Irish surnames began
Ireland was one of the first countries in Europe to use hereditary surnames, with families taking fixed names from about the 10th century. Most native Irish surnames are formed from the name of an ancestor with Ó ("grandson" or "descendant of") or Mac ("son of"), and many belonged to powerful septs — related family groups tied to a particular territory.
English rule, the use of English in records and heavy emigration in the 19th century led many families to drop the O' and Mac prefixes or to translate and anglicise their names. In the late 19th and 20th centuries, a Gaelic revival led many to restore them, which is why both Kelly and O'Kelly, Neill and O'Neill exist today.
How the names work
Irish surnames usually appear in two forms: the original Irish (Ó Néill, Mac Cárthaigh) and the anglicised form (O'Neill, McCarthy). In Irish, a woman's form differs: Ó becomes Ní and Mac becomes Nic, so the daughter of a man named Ó Briain is Ní Bhriain. Many Irish surnames are concentrated in the county or province their sept once ruled, which can be a helpful clue for family history.