In many societies, shepherds were an important part of the economy. Unlike farmers, shepherds were often wage earners, being paid to watch the sheep of others. Shepherds also lived apart from society, being largely nomadic. It was mainly a job of solitary males without children, and new shepherds thus needed to be recruited externally. Shepherds were most often the younger sons of farming peasants who did not inherit any land.
In modern times, shepherding has changed dramatically. The abolition of common lands in Europe in the eighteenth and nineteenth century moved shepherding from independent nomads to employees of massive estates. Some families in Africa and Asia have their wealth in sheep, so a young son is sent out to guard them while the rest of the family tend to other chores. In the USA, many sheep herds are flocked over public BLM lands.
Here a nice collection of bereted shepherds from both sides of the Pyrenees Mountains.
And the best picture comes last, from Aragon in Spain.