Why was "A Midsummer Night's Dream" written?
Why was the play written, how did Elizabethans veiw magic and fairies, how would this affect Shakespeare's viewpoint and play and how might a modern audience differ from an Elizabethan audience in their watching of the play.
I'm afraid this one really gets the standard Shakespeare answer: we just don't know. Shakespeare didn't leave us any solid information about why he wrote certain plays or what occasions they were written for!
What makes talking about "A Midsummer Night's Dream" particularly difficult is is that, while most of Shakespeare's other plays borrow their plot from a key source, although the "Dream" does have several sources, it is mainly Shakespeare's own invention.
One popular theory is that, because of the play's emphasis on fertility, children, and - at the end, particularly - weddings, marriages, and weddings nights, the play was written for some sort of wedding. Some critics think that Elizabeth I is explicitly mentioned in these lines of Oberon's from Act 2, Scene 1:
And the imperial votaress passed on,
In maiden meditation, fancy-free.
David Wiles, the scholar, in particular believes that the play was composed for the wedding of Elizabeth Cary and Thomas Berkeley in February 1596. Was the "imperial votaress", Elizabeth I, present at the wedding feast that the "Dream" might have been played at? Perhaps. Is there any real evidence? No. We just don't know.
I'd caution you against generalising about what the Elizabethans believed about fairies - just like today, there were probably a wide spectrum of varying beliefs. But I've linked to a great website below with info about Elizabethans and fairies.