What was William Shakespear's motivation to write Romeo and Juliet?
Romeo and Juliet was one of Shakespeare's earlier plays, and although it is a tragedy, it's also a love story which sets it apart somewhat from other tragedies.
Many critics have noted that Romeo and Juliet has some significant departures from standard plays of its time.
So it could have been that Shakespeare wanted to experiment a bit with the form and function of the play, while creating an epic and tragic play with a serious romance-- while also creating an excellent entertainment for theatregoers.
Romeo and Juliet is fashioned after another, older, and parallel Greek story Pyramus and Thisbee. (I'll let you look up this story for the similarities.) Unrequited love is a common theme in literature, perhaps Romeo and Juliet is the most famous and well-known for this genre of love story.
FYI: These characters also are used in Midsummer's Night dream.