The selection of a head of state reflects the values that society thinks is important. In ancient times a ruler, generally a king, had to be adept at making war. Monarchy was a warlike task, but kings also had to enforce justice in their realms. The trouble with having a warlord as head of state is that the ability to fight is not always associated with wisdom,virtue or political competence. Some kings, many or most maybe, were greedy for power and wealth and were often cruel to their own people. Roman emperors,though they claimed to promote peace, were hardly paragons of justice and stood at the apex of a system of power at the bottom of which were slaves and women.
Enlightened minds in ancient times saw the weaknesses of this system, and wise folk often tried to guide the king to rule justly. Plato, the Greek philosopher, attempted to design a society in which a set of philosophers ruled by a philosopher king dominated society. Plato's philosopher king model was never really tried, but its descendant is the one party state governed by a tight clique who share a common pilosophy. States like this are horrid places in which dissent is persecuted.
The alternative solution is biblical. The monarch of Israel rulled under God, and was subject to God's law, as King David discovered when he had Uriah the Hittite killed to get his wife.He was taken to task by the prophet Nathan.The biblical ideal is expressed in the Christian ideal, that Christ is the true king of kings and that therefore political and religious leaders operate under God. This idea works well in a Christian society and was, I believe, the guiding principle that governed Elizabeth the Second's life, and it is still at the basis of the British politicalsystem, but it is hard to implement this in a modern secular society.
Other systems have their weaknesses. I once heard two engineers discussing why society should be ruled by engineers, oblivious to the fact that a narrow talent base among politicians would be a limitation on the competence of government. A French philosopher, Comte, stated that society should be ruled by a committee of sociologists. No comment on that dream, sorry, nightmare! Theocracies, government by religious authorities, do not fare well, though the papal states were an example of generosity to the poor. But Iran is hardly a happy place, and Afghanistan has people trying to escape.
In truth, all systems are run by flawed human beings. Britain had a devoted, hard working monarch whose life was governed by a good value system and the new king will try his best. But hereditary monarchy is a lottery, and there can be unworthy successors. But elected presidents cannot be relied on to be virtuous, and they have had to rise up the greasy pole of politics with moral compromises in their past. The British public fell for the blandishments of Boris Johnson, who sold them the deception of Brexit, a disaster for Britain, but a way to the prime minister's role for himself. Electorates make mistakes. So who should be head of state?