Shakespeare uses two distinctly different locations in the play A Midsummer Night's Dream. One (the setting at the beginning and end of the play) is the court and city of Athens in ancient Greece, and the second is an unnamed forest, or woods (the setting of the middle section of the play).
There are a few significant observations to make about these two settings:
- The first setting, Athens, represents the "real" world with all its problems and mundane human daily life. The second setting, the woods outside Athens, represents the fantastical events of a dream. At the end of Act I, when the setting switches to the forest, it signals the beginning of the "dream," and when the Lovers and Bottom are awakened in Act IV, they are literally returned to their real lives in the mundane world of Athens.
- The world of Athens and its court is one of law and order, ruled by the logic of the laws, rather than by emotion or feeling. This is displayed by Theseus as he sides with Egeus over Hermia's impassioned plea. He must choose the law. In the forest, however, Titania and Oberon rule with their emotions, plotting and scheming against each other, but just as swiftly overturning and forgiving when their moods have shifted. So, the world of Athens is one of law and order, and the world of the Fairies in the forest is one of emotion and caprice.
- For Elizabethans, the woods represented magic and mystery and fairies really did live there. It was a magical and somewhat forbidding place, where unexplained and sometimes frightening events could transpire. Thematically, this relates to a darker, hidden world, while the world of Athens is a light and predictable (though sometimes unhappy) place.
To answer your specific question about the shifts, they happen between Acts I and II, when the scene changes from Athens to the woods, and then, during Acts IV and V, there is a more gradual transition back to Athens.
Theseus, Hippolyta and Egeus wake the Lovers as they are hunting in Act IV, thus bringing a bit of the law and order of Athens to the edge of the woods where the Lovers sleep. Theseus, it seems, is affected somewhat by his proximity to the world ruled by the emotions (the woods), as he decides to pardon Hermia for her disobedience and allow the Lovers to join himself and Hippolyta on their wedding day.
Act IV, scene ii brings the play fully back to the daily world of Athens, as the Mechanicals, gathered at Quince's house, await the return of Bottom. As a note: Quince's house is also a "setting," but is contained within the perimeters of the world of Athens, so I have not listed it as a "major" location.
For more on the settings of A Midsummer Night's Dream, please follow the links below.