There are numerous examples. In a coming - of - age novel, a character might say 'All the world's a stage' from 'As You Like It' to express how they feel about growing up and the different roles they have to play in life. And in a detective novel, 'The lady doth protest too much, methinks' from 'Hamlet' could be used to show that a suspect is being overly defensive, which might lead the detective to suspect them more.
One example is the use of 'To be, or not to be' from 'Hamlet' in many novels. It can be used to convey a character's internal conflict about life choices. Another is 'Shall I compare thee to a summer's day?' from 'Sonnet 18' which might be used to describe a character's beauty in a romantic novel.
In some historical fiction novels, you might find quotes from Shakespeare's history plays. For instance, from 'Henry V', 'Once more unto the breach, dear friends, once more' could be used to show a character's courage and determination in the face of a difficult situation. Also, in a dystopian novel, a line like 'Fair is foul, and foul is fair' from 'Macbeth' could be used to describe the twisted world of the story.