In ancient times people used to use their fathers name to announce themselves or what tribe they were in. For example: the Arabs, they would quote the names of their fathers, father, and still say ibn (son) in their names till this day.
Surnames vary from country to country, too. Some countries (like Scandinavia) use surnames derived from the father's given name.
So, in Iceland, if Erik had a son name Lief, he would be Lief Erikson (or Eriksson) while Ragnar's daughter, Elin, would be Elin Ragnarsdottir. It tends to make the Icelandic telephone directory difficult to navigate.