Dramatic irony occurs when the audience or a character (or several characters) on stage are aware of something that another character is not.
For instance, at the end of Romeo and Juliet the audience is aware that Juliet is not dead after having taken a sleeping aid. Romeo believes her to be dead and so kills himself.
This is dramatic irony as Romeo is unaware of an important fact in contrast to the audience, which is fully aware of that fact.
In this example we see the dramatic effect of a writer using dramatic irony. Because we, the audience, know Juliet is not dead and only sleeping, we react to Romeo's actions emotionally. We are emotionally engaged in his action because we know he is making a mistake.
Dramatic irony is often used in suspense and horror films as well. For example, if a character unwittingly re-enters a house after a villian has already gone inside, the audience knows something that the character does not know. This is classic dramatic irony. And it works. The audience has an emotional response to the character's decision to go back into the house because the audience knows something the character does not.