This is called the dramatic irony and it occurs when the audience knows more than the character. Thus it is interesting for the audience to see how the characters will react once they find out. This type of irony was common in the ancient times since the tragic fate of Greek characters was already known to the audience.