There was no concept of surnames or identity tagging during the Vedic period. The tagging of names with Surnames is a recent phenomenon. During Vedic times, it was the first name. The identities of many contributors in Rigveda, other than deities, are given below. These contributors were often called Brahmins as they executed rituals (Brahmanas). Some of their names were:-
Atri, Adhvaryu, Agniras, Brhaspati, Bhardwaj, Kanva, Tarasadasyu, Gavisthira, Vasistha, Jamadagni, Kasyapa, Vimada, Visvavanara, Kutsa, Samvarana, Vatsa, Vyasha, Dasyave-vrka, etc.. mainly
Some of these names are also used in Hindu Gotras. Gotras means Cowshed. The lineage used to connect to the cowshed you are associated with a particular sage. This concept of Gotra came later. In Rigveda or any of the Vedas, no such concept was mentioned. Lineage protection was not a Vedic concept. Chinese first started using it in the 2nd Century BC, as per Wikipedia.
The word descent or lineage appeared in a few places in RigVeda.
म॒न्युरिन्द्रो॑ म॒न्युरे॒वास॑ दे॒वो म॒न्युर्होता॒ वरु॑णो जा॒तवे॑दाः । म॒न्युं विश॑ ईळते॒ मानु॑षी॒र्याः पा॒हि नो॑ मन्यो॒ तप॑सा स॒जोषा॑: ॥ (RV 10.83.2)
“Manyu was Indra, yea, the God, was Manyu, Manyu was Hotar, Varuna, Jatavedas. The tribes of human lineage worship Manyu. Accordant with thy fervour, Manyu, guard us.” (Griffith Translation)
Marriage within the same Gotra was later prohibited, but there is no such prohibition in any of the Vedas so far I can see. Later, the system possibly wanted to diversify the knowledge and create a good mix of diverse thoughts and practices by banning the same lineage, which had its own pros and cons. I could not find much credible research on why such restrictions are implemented, but they may have faced some social or health concerns, which may be a good research topic for a Ph.D. student. We don’t know what we don’t know.
Later, during the 9th century BCE, Gotra was redefined in Birihadaryanka Upanishad as the lineage of Saptarishi — Kashyapa, Atri, Vasistha, Vishvamitra, Gautama Maharishi, Jamadagni, and Bharadvaja (Star Constellation -Ursa Major).
The literature review on the public domain points the surname towards a Western concept. Earlier, the optional use of the father or husband’s name was used, and later, the village names were used to be tagged. But I do not deny that people also used the professions to indicate what they do. For example, Agnihotri (perform sacrifices?) or Chaturvedi (Recite all four Vedas?) are classic examples. But it could be more recent comparatively. One can argue that Maharana Pratap has Sisodia as a Surname and Chandragupta has Maurya as a surname, but these surnames depict the dynasty more. Kautilya did not have the surname; his actual name was Vishnugupta, but Dhana Nanada had the dynasty name attached. We see Mandana Mishra, the 9th-century AD philosopher who contributed to the Mimansa school of philosophy, had a surname. Hence, anecdotally, somewhere between 200 BC and 900 AD, this concept of surnames became more popular in the subcontinent, some connected to the dynasty. This needs further research on when exactly it changed and how.
In the West, with the evolution of society, which started organizing with the economic growth. In Iceland, it follows patronymic and/or matronymic systems.