From the Nelson Mandela Foundation:
Madiba – This is the name of the clan of which Mr Mandela is a member. A clan name is much more important than a surname as it refers to the ancestor from which a person is descended. Madiba was the name of a Thembu chief who ruled in the Transkei in the 18th century. It is considered very polite to use someone’s clan name.
Tata – This isiXhosa word means “father” and is a term of endearment that many South Africans use for Mr Mandela. Since he is a father figure to many, they call him Tata regardless of their own age.