Throughout the play, Shakespeare depicts European society as flawed and chaotic, which enables master puppeteers like Iago to manipulate high-ranking citizens like Othello and Michael Cassio and corrupt respected institutions like the Venetian military administration. The fact that Iago deserves to die may reflect Shakespeare's underlying message that justice is not always served and that government institutions are often as flawed as the people who represent and run them.
Another possible reason as to why Iago does not die at the end of the play is because he is a high-ranking Venetian official, and having him murdered without a trial would not accurately represent the civil European justice system. Another possible reason as to why Iago remains alive at the end of the play may concern the belief that death serves as a relief—which is, in fact, Othello's belief. If this is the case, Iago would be forced to live with the guilt and shame of his horrific crimes even though he is portrayed as a heartless, callous man. At the end of the play, Iago refuses to speak about his scheme, but Gratiano says that he will be tortured. Although Iago is not killed, the audience experiences some satisfaction knowing that he will be tortured for his evil deeds.
To kill Iago would be to relieve him of the guilt and misery he experiences. Although it is hard to believe Iago has any feelings at all, his main disappointment is that he has lost all chances of becoming a high-ranking official. Iago would rather die than live with the knowledge that all his scheming came to naught.
In the play, dying is seen as an honorable and even comfortable end. There are several examples of this. One is the fact that Othello kills Desdemona in their marriage bed. Emilia stands her ground against a crazed Othello, accepting her fate and welcoming the chance to die next to her "lady" Desdemona. Another example is Cassio's handing the dagger to Othello; it is Cassio's final act of respect and honor to Othello, allowing Othello to depart on his own terms without having to endure the humiliation and disgrace of being imprisoned.
You may often hear or see Iago being referred to as Othello's "ensign." An ensign is sometimes also referred to as a "standard-bearer." In either case, Iago serves as a military officer, "a man of...of loyalty and trust" to Othello's face, but he turns out to be a villain and an "inhuman dog" who is egotistical and evil.
Iago may not die onstage, but his doom is certain. In the play's final lines (5.2.377-381), Lodovico directs Cassio, in his first assignment as the lord governor:
...To you, Lord Governor
Remains the censure of this hellish villain.
This time, the place, the torture, O, enforce it!
Myself will straight aboard, and to the state
This heavy act with heart relate.