Where did Shakespeare get the ideas for his plays?
To offer a specific instance of Shakespeare's inspiration for one of his plays, we might look to the rather well-known essay by T.S. Eliot on Hamlet. In this essay, one of Eliot's first attacks on Shakespeare's most widely regarded tragedy is to suggest that the play is not at all original with Shakespeare.
"The Hamlet of Shakespeare will appear to us very differently if, instead of treating the whole action of the play as due to Shakespeare’s design, we perceive his Hamlet to be superposed upon much cruder material which persists even in the final form" (Eliot, 1920).
Eliot attributes the original design to a writer named Thomas Kyd, author of The Spanish Tragedy, and mounts an argument that Shakespeare fails in Hamlet to fully contextualize or explain the extreme behavior of Hamlet (the character). The reason for this, according to Eliot, is that, in borrowing from Kyd, Shakespeare simply fails to do enough adaptation.
"Shakespeare’s Hamlet, so far as it is Shakespeare’s, is a play dealing with the effect of a mother’s guilt upon her son, and that Shakespeare was unable to impose this motive successfully upon the “intractable” material of the old play" (Eliot).
When Eliot makes the memorable claim that Shakespeare's Hamlet is "the 'Mona Lisa' of literature" it is due to the fact that the play is not interesting because it is a work of art, but, he suggests, is seen as a work of art because it is so intriguing.
Whether one agrees or disagrees with Eliot as to the qualities of Shakespeare's Hamlet, it is difficult not to accept his argument about the ways in which Shakespeare leans heavily on references and existing material to underpin the plots of his plays. Where the Bard's sources are somewhat obvious in his "histories" like Henry V, Richard III, and even Julius Caesar, there are also strong and clear resonances with source material in his tragedies.
Hamlet shares many themes and conflicts with the Greek tragedy of Electra (not to mention the Antigone). In Electra, a king is killed by his wife and her lover. The children feel that they must act to avenge their father's death, yet to do so would mean to commit matricide - an act that goes against the gods. In the end, a sense of justice wins out and the children kill their mother (only to be harried by the Furies soon afterwards).
The parallels to Hamlet are immediately striking and certainly serve to suggest that Shakespeare's plays may contain reference to works older than those of Thomas Kyd.
From all over... European authors both contemporary and before his time, mythology, daily life, folk tales, songs, history--English, Greek, Roman, Italian, etc.
Shakespeare strikes me as someone who was amazingly observant and who never forgot an interesting conversation or phrasing. He must have been well-read or there wouldn't be so many obvious references to Chaucer, Ovid, Plutarch, Gascoigne, and other famous writers and published works. Mythological and Biblical allusion are also prolific in his works.
So, to answer your question, he got his ideas from the same places that modern writers get their ideas. All you have to do is look around and listen carefully to find fuel for your next bestseller.
Shakespeare got much of his inspiration from playwrights that lived long before he was born. It is a well-known fact that Shakespeare "borrowed" ideas from other pieces of literature and built around those ideas sometimes. Some people have questioned if Shakespeare could have written all of the plays that have been credited to him; we'll never know, but in my opinion, there is no reason to believe that he did not write all of these wonderful plays!