It's a common literary device where the audience is aware of something that a character is not, creating a sense of suspense and often humor.
Here's an example:
* In Shakespeare's Romeo and Juliet, the audience knows that Romeo and Juliet are still alive after they take poison, but Juliet's nurse does not. This creates a powerful moment of dramatic irony as the nurse mourns what she believes is the death of Juliet.