In literature, [irony] is the technique of indicating an intention or attitude opposed to what is actually stated. Often, only the context of the statement leads the reader to understand it is ironic. Irony makes use of hyperbole, sarcasm, satire, and understatement.
Some things are identified as ironic, when they actually are not. In Alanis Morissette's song, "Ironic," rain on one's wedding day is not ironic. There is a hope that it will not rain, but there is every possibility that it will occur, as the weather is often unpredictable. However, a fireman's house burning down is ironic. The home of a policeman being burglarized is also ironic.
In simple terms, irony is often described as the difference between what is said and what is meant, or the difference between what is expected and what actually happens.
There are four different kinds of irony. Cicero defined verbal irony as "saying one thing and meaning another." (There may be the presence of sarcasm with verbal irony.) Situational irony is found when a fireman's house burns down, or with what some call poetic justice: when "accidental events occur that seem oddly appropriate." One example is when a con-artist is tricked by someone else. Dramatic irony is the most significant form of irony in literature. In this form, the audience is often aware of something that the character is not. For example, in Shakespeare's Macbeth, the audience knows that the witches have no desire to help him: they simply want to lead his soul to its eternal damnation.
Some scholars also recognize rhetorical irony. In this case, a speaker is unaware of the irony in the situation in which he is involved. For example, in Mark Twain's Huckleberry Finn, Huck believes that because he loves Jim—a slave in the Deep South—like a brother that he is a sinner and will go to hell for his actions. His love and commitment for Jim cause him to defy societal conventions and accept his fate. He takes a letter he had written to Jim's owner, when he considered turning him in, and destroys it.
"All right, then, I'll GO to hell" -- and [he] tore it up.
Irony is the juxtaposition of two elements that do not "fit," that are surprising together, situational irony; saying something in a way that suggests you mean something altogether different, verbal irony; or a situation in which the reader or audience has a greater awareness of what is going to happen, but the characters are surprised by what happens, which we call dramatic irony. Some struggle with defining what irony is exactly. An example of the first might be O. Henry's story, "The Gift of the Magi," in which each of the characters gives up what each holds most dear to buy a gift for the other, a gift that is now useless because of what the other has given up. An example of verbal irony would be my saying about a really ugly house that, well, it is quite beautiful, using some sort of tone that would allow my listeners to understand that I meant the opposite. An example of dramatic irony is Romeo and Juliet, the audience knowing that Juliet is not dead, but Romeo not realizing this. In each instance of irony, there is a "surprise" or an opposition to literal meaning.