Shakespeare actually uses irony in order to develop the humor throughout the play. Irony can actually be the most useful tool for developing humor within a comedy. We mainly see two types of irony being used in A Midsummer Night's Dream, dramatic and situational, and both elements are mainly developed through characterization and plot. The irony develops humor because the irony presents absolutely ridiculous situations that we recognize as funny.
Dramatic irony refers to moments in a story in which the reader/viewer knows more about the character's current situation than the character actually does. Good examples of dramatic irony are seen with respect to the lovers and developed through the plot concerning the lovers as well as characterization. None of the Athenian lovers have any clue that they have been enchanted by Puck and that the nightmare unfolding before them is all Puck's doing. In particular, Lysander is characterized as actually believing that his own reason has told him that Helena is the better woman for him than Hermia, as we see in his lines, "The will of man is by his reason sway'd, / And reason says you are the worthier maid" (II.ii.117-118). Hence, we see that Shakespeare developed dramatic irony through plot structure and characterization. Furthermore, since the lovers believe that their actions are their own doing, we see that the irony has been used to create a ridiculous plot line.
Situational irony is also developed through the plot. In situational irony, what happens in the plot is the exact opposite of what the reader/viewer is expecting to happen. Situational irony often overlaps with dramatic irony in A Midsummer Night's Dream. One example is that because the play starts out with two men pursuing Hermia, the audience would never really expect both men to begin pursuing Helena, the exact opposite woman. Again, since the situational irony creates an absurd situation, we can see how Shakespeare used situational irony to develop humor. Puck describes the humor of the absurd situation best when he declares, "[T]hose things do best please me / That befall preposterously," meaning "absurdly" (III.ii.121-122).