Irony, in general, is a contrast between what is stated and what is meant, or between what is expected to happen and what actually happens.
In particular, dramatic irony involves a contradiction between what a character thinks and what the audience or reader knows to be true.
This type of irony occurs frequently in theatrical productions and in cinematic productions. One very simple form of dramatic irony is used in the horror film industry. This is often exemplified as a young, naive woman walks down a hallway or onto a dimly lit path of some kind where the audience knows that the monstrous creature or maniacal killer hides and waits for her.
In classical works and in modern theatrical productions, dramatic irony is frequently employed. In The Odyssey, for instance, there is dramatic irony in the scene that takes place in the swineherd's hut because Telemachus and Eumaeus do not know that the beggar is really Odysseus in disguise, but the audience does know.
In another example, there is dramatic irony in Shakespeare's Macbeth early in the play. When the second witch addresses Macbeth, "All hail, Macbeth, hail to thee, Thane of Cawdor!" (1.3.50) Macbeth ponders,
....I know I am thane of Glamis;
But how of Cawdor? the thane of Cawdor lives,
A prosperous gentleman...(1.3.72-74)
But the audience knows that King Duncan has earlier ordered the death of the Thane of Cawdor because in Scene 2 he was found to be a traitor.
No more that thane of Cawdor shall deceive
Our bosom interest: go pronounce his present death,
And with his former title greet Macbeth (1.2.63-65)