What might have influenced Shakespeare to write such an imaginative play as The Tempest?
The Tempest, although listed first in many collections, was the last play written entirely by Shakespeare. Subsequently, he contributed to The Two Noble Kinsmen and Henry VIII by John Fletcher. The Tempest was also the only play Shakespeare wrote that didn't have an original source; he himself created the whole plot. However, the play reflects the news of the day regarding the settlement of the new colony of Virginia, to which England had sent 9 ships to supply the fledgling colony. The flagship, carrying the new governor of the colony, was separated from the rest during a storm off Bermuda and was given up for lost. After surviving the shipwreck, the survivors managed to rebuild a boat and sail to 600 mile distant Virginia, arriving nearly a year late. It was as if they had come back from the dead. The play also appears to have been part of the festive preparations for the marriage of Elizabeth, daughter of James I and Frederick IV of the Palatinate, or around what is now Germany. The couple were married in 1613. The Tempest, then, which includes a wedding masque in the middle of the play, was written by commission as a wedding celebration.
Asimov's Guide to Shakespeare, Gramercy Publishing, 2003 ed., pg I-667.
Good question--While The Tempest does include elements that are quite different from Shakespeare's other plays, it also includes many of the playwright's standard motifs and techniques, such as supernatural elements and comical characters (Ariel is not so different from Puck in Midsummer's Night Dream). However, The Tempest is Shakespeare's only play set so far from England, and he could have been inspired to set it on a far-removed island because he lived during the era when exploration was on the rise.
As far as the whimsical elements of the play, Shakespeare knew that his audience, both the groundlings and his wealthy patrons were superstitious and had an interest in the supernatural; so part of his motivation for writing such a play could have been simply a financial one.
Finally, many critics suggest that because Shakespeare wrote the play at the end of his career and during a time when he was trying to establish closer relationships with his daughters, his creation of Prospero and Miranda most likely reflects the relationship between the bard and his own daughters.