As long as humans have trod this planet, they have been killing each other. Life expectancy was short - especially after thousands of wars, it's remarkable the human race did not face extinction.
Other than crazy pointless killing, one would think there would be a pattern and a purpose for executions - why else. Note the painting shown is of the Battle of Borodino in 1812 http://www.napolun.com/mirror/web2.airmail.net/napoleon/Borodino_battle.htm, between the Russians and Napoleon's troops. What it shows is chaos; war is most often chaotic. So also, can executions be chaotic.
Throughout history, religious and political groups have implemented executions to make a statement, using the word "punishment" as justification.
Current questions might be: is the concept of capital punishment justifiable; is every human life valuable; should a person be executed if they disagree with you; can one person decide the truth for another; "can you ever be absolutely sure a person is guilty."
We all have certain expectations of our governments to protect us from harm. Not exclusive to ancient times, various countries still use capital punishment to "teach a lesson" to miscreants or for those who simply disagree with leaders in power.
All humans are born into a particular culture which may be in varying degrees on a scale from totalitarian/authoritarian on one side, to an opposing system characterized by a representational political structure. No matter if a woman herds goats in Turkmenistan or a doctor removes an appendix in Cape Town, that person hopes/needs to be able to depend on leaders in their social structure to protect them from their fellow humans.
That is what capital punishment was designed to do - protect citizens from the evils of human nature. But who is there to say how much control is necessary? This is the time for wisdom. We presume that the execution of humans has evolved since ancient times. In some places, it has not.
There have been so many examples of execution atrocities, one can almost close their eyes and open the akashic record, sure to find an execution of aggravated proportions. Medieval times were particularly blighted. See "The Ovens at Neisse." http://ladyofspiders.wordpress.com/2008/02/07/punishment-torture-and-ordeal/ Neisse, Germany.