Walpole makes several references to the plays of William Shakespeare in The Castle of Otranto. The most obvious allusions are to Hamlet, another tragic story about the nature of power and princedom, the importance of bloodlines, and the effects of the past on the present. This allusion also explains the depth to which Walpole develops minor characters, as he mentions in the Second Edition Preface:
The great master of nature, SHAKESPEARE, was the model I copied. Let me ask, if his tragedies of Hamlet and Julius Caesar would not lose a considerable share of their spirit and wonderful beauties, if the humour of the grave-diggers, the fooleries of Polonius, and the clumsy jests of the Roman citizens, were omitted, or vested in heroics?
The Castle of Otranto contains many plot elements and themes that are similar to Hamlet: isolation, selfishness, growth, incest, and virginity. In a lot of ways, it's a novel version of Shakespeare's play. Walpole confirms this in the Second Edition Preface and in many of his own letters to contemporaries. He wasn't just inspired by Hamlet—he actually "copied" it as a model. Hamlet is one of Shakespeare's best known tragedies and was regularly performed in the period when Walpole wrote The Castle of Otranto. It was also often taught in schools, and so this allusion would probably have been a familiar one to many of his readers. By using Shakespearian stories as a "model," Walpole is providing historical framing and a distinguished literary precedent for his book.
It's also worth noting that just as in Shakespeare's plays, the dialogue and concerns of minor characters make up a good deal of the action of Walpole's novel. This has the effect of making The Castle of Otranto recognizably similar to a Shakespeare play. It also contributes to its internal realism, as it allows the reader to imagine characters who aren't central players with more clarity.
The author also points out that the "humor of the grave-diggers" and the "clumsy jests" of "citizens" is very important to Hamlet and to Julius Caesar. He argues that these moments of character development give the plays "a considerable share of their spirit and wonderful beauties." By saying this, Walpole responds to the criticism widely levied at him for the sensational and often silly parts of this book. He explains his own attitude toward nuance and character development for minor figures as following Shakespeare's example. If a literary "master of nature" like William Shakespeare wrote characters like thus, Walpole implies, he himself shouldn't be critiqued for doing the same.
In naming Manfred's submissive wife Hippolita, Walpole alludes to both a prominent mythological figure associated with peacemaking and to one of William Shakespeare's major characters. Hippolita is described in Chapter 1 of The Castle of Otranto as being gentle, forbearing, and as placing the needs of others before her own:
Hippolita, who knew his step, rose with anxious fondness to meet her lord, whom she had not seen since the death of their son. She would have flown in a transport, mixed of joy and grief, to his bosom; but he pushed her rudely off, and said, “Where is Isabella?”—“Isabella, my lord!” said the astonished Hippolita. [...] Willing, however, to save her lord from any additional shock, and prepared by a series of grief not to tremble at any accession to it, she determined to make herself the first sacrifice, if fate had marked the present hour for their destruction.
In this scene, Hippolita wants to help and comfort her husband and save him "from any additional shock" after the death of their son Conrad. All the language Walpole uses to describe her is maternal and selfless. Hippolita here and elsewhere is willing to "make herself the first sacrifice" if that's what her family needs.
Hippolita was the wife of the hero Theseus in Greek mythology, and she appears as such William Shakespeare's play A Midsummer Night's Dream. In both these tales, she is a woman who grows to love her husband although she is won "by violence." However, unlike Theseus, who loved his spouse deeply and loyally, Manfred loses interest in Hippolita by the middle of Chapter 1. He has already decided to forsake her for Isabella, which Hippolita accepts with characteristic restraint.
Hippolita is described—like the mythological character she is named after—as being too self-effacing and loyal for her own good. She agrees to divorce Manfred just to keep the peace. Unlike the Hippolita of legend, however, this woman doesn't die by the sword. When Manfred abdicates, Hippolita joins the local convent and becomes a nun, transferring her loyalty from her husband to the church.
The Castle of Otranto mimics—and, in that way, parodies—the style and content of many medieval stories in a way that draws attention to their characteristic hyperbole, sensationalism, and excess. Walpole does this to particular effect with the narrative of incest in the novel, beginning with Manfred's unwelcome advances to Isabella in Chapter 1:
“I desired you once before,” said Manfred, angrily, “not to name that woman: from this hour she must be a stranger to you, as she must be to me; in short, Isabella, since I cannot give you my son, I offer you myself.” “Heavens!” cried Isabella, waking from her delusion, “what do I hear! you, my lord! you! my father-in-law! the father of Conrad! the husband of the virtuous and tender Hippolita!”—“I tell you,” said Manfred, imperiously, “Hippolita is no longer my wife; I divorce her from this hour. Too long has she cursed me by her unfruitfulness.
This is so over-the-top and overwrought it seems silly, as do many of the other instances of these tropes of chivalry and courtly love. Manfred makes the decision to take Isabella as his wife very quickly, and his behavior seems especially egregious because of how rapidly he turns on his loyal spouse, saying he will "divorce her from this hour." The way that Walpole explains Manfred's reasoning for marrying Isabella and divorcing Hippolita only further confirms that this is an attempt at parody. His marriage to Hippolita is, after all, already "incestuous" in medieval terms, as she was previously his sister-in-law. Divorcing her to marry Isabella is just replacing one form of incest with another.
As Isabella is not actually Manfred's biological daughter, marrying her isn't technically incest, and his marriage to Hippolita wasn't biologically incestuous either. The problem is a social one: his position as Isabella's father figure makes it a violation of conventional morality in both Walpole's time of writing and in the medieval period. This desire for incestuous marriage is another example of the multifarious badness of this antagonist. Manfred is evil in so many ways that his character itself becomes ludicrous.
All the incest is also an allusion to the Shakesperian tragedy Hamlet, another tale of princely suffering plagued by suggestions of forbidden desires. Walpole was explicitly inspired by Hamlet to write this novel, and he cites Shakespeare's play as being important to this novel in the Preface to the Second Edition. Hamlet also contains a marriage between siblings-in-law: that is, between Gertrude (Hamlet's mother) and Claudius (his uncle). As in Walpole's novel, this one instance of incest seems to beget another. Hamlet's frustrated and repressed desire for both his own mother, Gertrude, and his potential bride, Ophelia, significantly impact his characterization and the plot. In the same way, Manfred's own desires for unsuitable women and everyone else's responses to them create much of the drama in The Castle of Otranto.