At times, the death penalty has been used as a cruel spectacle, with the slow deaths of crucifixion and burning at the stake in public. That type of execution comes from a society that is run by very cruel, vicious men who think that by appearing tough and brutal, they will scare people into submission. The Romans and the C17th Witch finders are obvious examples of that.
When execution is in private and it is quick, such as hanging, that is done in a society which places more emphasis on law and order and civility, such as the UK, when it still had the death penalty in the C20th.
The USA treads a middle path, with slower forms of execution such as gassing, that people can go and see, but are not in public. That reflects on US society, where there it is believed that being cruel and brutal will deter crime, but they want the veneer of being considered a civil society of law and order.