Sometimes surnames have meanings which indicate the occupation, hobby, or skill of the original ancestor that had it first.
My surname, for instance, is an Arabic word for "one who devotes their life to helping others". In the time that surnames were first given to Iranians, many people spoke Arabic, especially those that would give surnames to others. There was even a proffesor who had a surname which means "one who is rude and impolite". However, his family originally came from a small village, and didn't have a clue about what their name actually meant.
Sometimes surnames are based on descent from famous historical figures.
Saieds have names that indicate which descendant of Fatima Zahra they are from (Mousavis, Hosseinis, etc.)
Sometimes surnames tell geographic origins.
For example, Afganis come from Afganistan, Esfanis from Esfahan, Arabs from Arab states.