How to be sure that a punishment is successful
A punishment is successful not when it inflicts pain on the wrong-doer but when it transforms people and when it makes the society safer or happier. To ensure its success Islam used certain techniques in the what is called "verses of torture" in the Holy Quran such as:
1- Ensure Justice
When it comes to punishment in Hell, which is the biggest punishment, The punisher is an "ALL Knowing...ALL Merciful...ALL understanding" GOD. So the probability of injustice is ZERO. HE knows us inside-out, knows our intentions and our motives so if HE decides someone is to go to Hell than this is based on accurate knowledge . Also this means the punishment is definitely compatible with the guilt.
In the Holy Quran God says: "And the record [of deeds] will be placed [open], and you will see the criminals fearful of that within it, and they will say, "Oh, woe to us! What is this book that leaves nothing small or great except that it has enumerated it?" And they will find what they did present [before them]. And your Lord does injustice to no one." (18:49)
2- Forgiveness and understanding overrides Punishment
Abu Huraira reported Allah's Messenger, peace and blessings be upon him, as saying: "Allah, the Exalted and Glorious, said: My mercy excels My wrath."
(Sahih Muslim-The Book Pertaining to Repentance and Exhortation to Repentance-Book 50, Hadith 18)
The concept of forgiveness is always strongly attached to the concept of torture in Hell. I can tell you not a single verse that explains torture in Hell is not accompanied by either the concept of forgiveness or the concept on GOD's infinite capability.
The association of the concept of forgiveness with "torture in Hell" is so that a sinner never despairs or feels that GOD hates him for what he did and will never forgive him. This desperation is totally forbidden in Islam..GOD forgives and HE keeps on forgiving as long as you repent and as long as you are still alive.
Some people may depend on the unlimited forgiveness and think they can repent "later on" that is why some other verses had the concept of " GOD's infinite capability and knowledge" without the concept of forgiveness..this is targeted to this type of people to teach them that GOD is forgiving, but at the same time HE is "All Knowing and infinitely capable" so you cannot deceive or outwit HIM. This category of people need that severe threat to reconsider their ways.
In the Holy Quran GOD says: "And when those come to you who believe in Our verses, say, "Peace be upon you. Your Lord has decreed upon Himself mercy: that any of you who does wrong out of ignorance and then repents after that and corrects himself - indeed, He is Forgiving and Merciful." (9:54)
In the Holy Quran hell is mentioned 77 times and so does the word "paradise"
The word "payment or reward" is repeated 117 times, while the expression "forgiveness" is repeated exactly twice that amount, 234 times.
Even the history of our Noble Prophet, peace and blessings be upon him and the four righteous Califs, may Allah be pleased with them proves this concept.
When Prophet Muhammad, peace and blessings be upon him, entered Mecca victorious to be face-to-face with those who prosecuted, tortured and killed Muslims and who conspired to kill him personally and when he asked the people of Quraysh (people of Mecca) how they thought he was going to deal with them. They replied "as a noble brother and the son of a noble brother" that they expected nothing but goodness from him and he would deal with them kindly. The Prophet, peace and blessings be upon him, told them “I speak to you in the same words of the prophet Yusuf (Joseph) peace be with him, who spoke to his brothers” and Muhammad, peace and blessings be upon him, recited a passage from a chapter of the Qur’an relating to the story of Yusuf, peace and blessings be upon him: "No blame will there be upon you today. Allah will forgive you; and He is the most merciful of the merciful" (12:92). Then he announced to them that they are free and they may go where they please.
During a period of famine, Umar al-Khattab, the second righteous caliph may Allah be pleased with him, suspended the prescribed punishment for theft because he realized that there was a social justice issue with so many people going hungry and often being forced to steal food just to survive.
So the reason behind the "Verses of Punishment" in the Holy Quran is MERCY...like when you scare your children from doing something that would hurt them or others. You "scare" them to prevent them from hurting themselves or others...this is an act of mercy not tyranny.