Most people today would consider human sacrifice a kind of ritual murder. We see it as morally ugly.
There is quite a bit of evidence that it was, shockingly, practiced by a wide range of ancient cultures.
Modern scholars tend to be cautious about evidence of human sacrifice. It is such a horrifying and nightmarish practice that it tends to grip the imagination. I read a novel not long ago that vividly described human sacrifice by the Minoans in ancient Crete. However, the evidence that the Minoans practiced human sacrifice is slight. Some of the evidence on Crete may tell us about the practice of some other people who settled in Crete after the Minoans.
One reason for the caution is that allegations of human sacrifice can be weaponized and used as an excuse to vilify or even kill people. Cortez used the reality of Aztec human sacrifice as an excuse to murder and persecute the Aztecs. Preachers sometimes justify the scenario in the book of Joshua, where Joshua exterminates Canaanites, by saying that Canaanite human sacrifice justified such measures.
If you equate Canaanite with Phoenician, there is both archeological and textual evidence that in Phoenicia and its colonies people did do human snuff rituals. However, the practice may have become more common in later times. It is never mentioned in the vast literature discovered a Ugarit.
To realize that human sacrifice was not imaginary helps us see what was at stake in the Hebrew Bible. Deuteronomy 12:31 does not claim that the practice was widespread–just that it happened:
You shall not do so to Yahweh your God; for every abomination to Yahweh, which he hates, have they done to their gods; for they even burn their sons and their daughters in the fire to their gods (WEB).
If human sacrifice was rare, it may have been triggered by extreme events. It may have literally been a barbaric practice that happened when events threatened civilization. Or, in the aftermath of a traumatic event, people might have seen a drastic act as the only way to set things right.
We have an instance in 2 Kings 3:27 where the Bible says the threat of military defeat caused the king of Moab to sacrifice his son (or maybe the son of the king of Edom). We have Mesha’s official account of this war on an inscription. He does not mention this human sacrifice, although he does boast of slaying 7,000 captives of all ages as as sacrifice (see here, lines 14-17).
In other cases famine or plague may have triggered such desperate measures.
I say all this to call your attention to a newly revealed archeological find in Turkey. The find goes back to the Bronze Age sometime between -3100 to -2800. There is a study published by Cambridge University Press here. Part of the abstract reads:
Recent excavation of a large cist tomb at third-millennium BC Başur Höyük, in Turkey, shows that state formation in Mesopotamia was accompanied by a fundamental change in the value of human life within local ritual economy. Osteological analysis and study of the grave goods have identified some of the dead as human sacrifices. This was indeed a retainer burial, reflecting the emergence of stratified society at a time of instability and crisis.
A summary of the report for non-technical people is here:
The burials show evidence of large political and social upheavals around this time, when early states were forming in southwest Asia.
I wonder if human sacrifice was a measure that societies usually suppressed until there was a strong enough perceived threat that people felt they were toast unless something dire was done.
Underlying this was a sense of total obligation to God or the gods. Even the Hebrew Covenant Code said to give God the first-born sons (Exodus 22:29), although it left open-ended just how you were supposed to give your children to God.