The word 'irony' is commonly misused as if it meant
sarcasm. As
Draeis explains explained above, there are three forms of irony. But sarcasm isn't one of them. This horse is still breathing fitfully so I'll give it a few more lashes.
There are three forms of irony, rhetorical, dramatic, and situational. The original and proper meaning, as a figure of speech, is the rhetorical. The other two are derivatives of it.
To dispose of dramatic irony first, because it's the least known, so it's least misunderstood. When you the audience know something the characters don't, so you see the hidden meaning, threat, doom, or whatever. In a soap opera you get to hear what Shirl says to Craig in the bedroom, but you also see the other scene where Shirl is telling her terrible secret to Charlene. Craig would behave differently if he could see that.
Situational irony is what most of the write-ups above discussed. (There seems to have been a cull since I wrote this.) How ironic that such-and-such happens just when So-and-so was about to... This is irony, but it's a derivative sense. It comes from a wider application of dramatic irony, as if the fates or the gods were spectators at the farce we unwittingly perform for them.
Now at last to rhetorical irony, irony in speech. Its essence is not the cutting, the sarcastic, the mocking, the satirical, or any other such emotionally charged deliveries. Irony is simply saying one thing and meaning another, and, since that covers the lie as well, intending the other to be understood.
When you make a mistake and mutter to yourself, "Oh! that was clever!", that's irony. You're saying "clever" to mean "not clever". You're not taunting yourself, you're simply using a figure of speech that works by opposites.
Sarcasm is usually, but not necessarily, delivered ironically, but you can have either wihout the other. If you sneer at someone, "Oh, wasn't that clever!", that's sarcasm (the biting tone of voice) and it's also irony (saying one thing and meaning its opposite). If you said "Oh, wasn't that stupid!" in the same tone, it's still sarcastic, but no longer ironic.
Sarcasm, satire, mockery, and parody go together. They're styles, intonations, intentions.
Quite different from them are another group, including irony, exaggeration, meiosis, and litotes, which are all analysable properties of the words used.
Meiosis means 'lessening'. It's when you say a small thing and mean a large thing. As when you say "Old Jones knows a bit about economics", meaning "knows a lot about..."; or when someone is said to have "a little place in the country" meaning a palatial manor.
Litotes is saying one thing by negating the opposite. To say someone is "not a bad shot", meaning specifically that they're a good shot. It may also include the "not un..." construction: if you use "not uncommon" to mean "common" (rather than a middle value).
Irony is saying one thing by saying the opposite.
"This next theorem is obvious so you can do the proof as your homework", says the lecturer, when it isn't. Or: "That charming and elegant child just vomited on my shoes."
In one point I must emphatically disagree with what Draeis had said. You do not need markers of irony. It can even spoil the effect if you mark it out as irony, like explaining the punch line for those who didn't get it. The best irony is unmarked. And as such, it is often misunderstood. If you're a good ironist you just have to get used to this. Alas.