The ritual of the Aztec flower war all started with Tlacaelel, an emperor of the Aztec empire. Tlacaelel brought the empire to the height of its power in the 1400s. He began to rewrite the history of the Aztecs, burning old history texts and emphasizing that his people were the chosen of the gods.
Before the start of the Aztec flower war (or, more properly, the Flowery War), the Mexicas were already a warrior people, and a very religious people. The men were hired out as soldiers, and so they were useful but also feared. Their god Huitzilopochtli was a god of war, the sun god, though the Aztecs actually had dozens and even hundreds of gods (more as the years went by and new peoples were conquered).
Tlacaelel emphasized the allegiance to Huitzilopochtli. The Aztecs were chosen to nourish the gods, and this had to be done with blood. New prisoners would need to be captured to provide this blood (though the Aztecs themselves at times provided it). This meant a strong sense of purpose for the Aztec empire, a state of constant warfare, and a reign of fear.
To the East of the growing Aztec empire was the city-state of Tlaxcala. The Tlaxcalans were a powerful people who shared their culture and language with the people of the Aztec empire proper. They were closely related with the empire, though never actually conquered by it. An agreement was made with the Tlaxcalans to have ritual battles called xochiyaoyotl, or the flowery wars (commonly called the Aztec flower war). The goal of these battles would not be taking land or killing the enemy, but simply capturing prisoners.
The prisoners would then be taken to a temple and sacrificed.
The Aztec flower war concept became an important part of the Aztec culture. As we know, this was already a war-like and religious people. The concept of the xochiyaoyotl fit well into the world view of the people.
The warriors continued to conduct skirmishes not only with the Tlaxcalans, but other neighbouring peoples. Though at times the people did actually go to war to conquer a people, very often they simply took a few prisoners to sacrifice to the gods.
On of the most shocking things about a lot of these sacrifices was that the person being sacrificed often went willingly. This was not a screaming victim being tortured and killed. Rather, it was, often, a mutual agreement being carried out. A glorious afterlife (which still involved warfare, by the way) awaited the victim. Find out more about how the Aztec flower war fit into the Aztec religion.
Though there was a certain amount of strength in this rule of fear, it had its weaknesses. More and more people were being sacrificed, and that weakened the peoples of Mexico immeasurably. People did grumble - especially people outside of the empire that saw the unprecedented flow of blood from the outside.
Though the Tlaxcalans took part in the Aztec flower war in part willingly, in reality they hated and feared the empire. It's believed that the Aztecs could have easily taken Tlaxcala, but the city was kept alive as a "farm" for new human sacrifices. When the Spanish came from across the sea, it was the people of Tlaxcala that eventually joined them against the Aztec empire. The empire fell, and the flowery wars ended.