A couple of years ago, I stumbled upon the thoughts of René Girard. It's a pretty rare occasion when something makes you really think about the most basic things in a new way. That tweet led me to reading a bit more about it (thanks Dan!).
People are driven by memetic desire. Beyond our objective needs, what drive us most is wanting what others want. To put it in game theory terms, my utility function is a function of the utility function of others. This most obviously explains things like fashion for example. But also, more deeply, the notion of status in society.
I want something because others want it. This is a self-reinforcing mechanism, and the object of desire can become scarce, so it creates occasional instability, frenzies of desire, and ultimately violence. This is a fundamental process in all human societies.
The way societies deal with it is through scapegoating. As the frustrated desires get stronger and stronger and become unsustainable, societies create scapegoats: some individual or group which is blamed for the inability of the many to satisfy the memetic desire. The frustration of desire reaches a paroxysm of violence on the scapegoat. Scapegoating works as an auto-immune mechanism: by channeling the violence onto the scapegoat, and even institutionalizing it, society avoids self destruction. And societies that don't scapegoat fall apart into chaotic violence. Thus scapegoating is an evolutionary adaptation to memetic desire.
This sheds some light on the institutionalization of violence throughout history, whether it is Mayan human sacrifice or the politics of immigration.