Ní - female decendant. For example, Ní Chonaill (Female descendant of Conall)
Mac - son of or male child. For example, Mac Mathúna (Son of Mathún). This prefix can be used whether or not the surname is a patronymic.
Uí - descendants. For example, Uí Bhriain (descendants of Brian)