In fact, much of the content of Shakespeare's plays isn't even written in verse. There's plenty of prose in Shakespeare - indeed, at least one play (Merry Wives of Windsor) is written almost entirely in prose. But when he did use verse, it's usually iambic pentameter, with some exceptions.
Note that none of this is by chance. There's actually a pretty consistent pattern governing when he used prose and when he used verse, and similarly, when he broke the pattern of iambic pentameter, there was usually a reason for it based on the nature of that particular speech.
The types of writing in Shakespeare's plays is usually split into three distinct types: rhyming verse
, blank verse
, and prose
. As a general rule of thumb, blank verse is the standard, while rhyming verse is reserved for more flowery speeches or occasions when it's OK to sound a little unnatural, and prose is used for more down-to-earth talk, often between lower-class people. This excellent introductory article
to prose and verse in Shakespeare covers not only the meanings and some examples of each of the three (you're probably already familiar with these terms) but also a nice summary of how each of them tends to be used in Shakespeare's plays specifically. Quoting this article with some added emphasis:
PROSE is used whenever verse would seem bizarre: in serious letters (Macbeth to Lady Macbeth; Hamlet to Horatio), in proclamations, and in the speeches of characters actually or pretending to be mad (Lady Macbeth; Hamlet and Ophelia; Edgar and King Lear) -- verse is apparently too regular and orderly for expressing madness. Prose is used for cynical commentary (e.g. Jacques and Touchstone in As You Like It; Edmund in King Lear) or reducing flowery speech to common sense terms (all over As You Like It). It is used when the rational is contrasted with the emotional (Brutus vs. Antony in Julius Caesar). It is used for simple exposition, transitions, or contrast (the first scenes of As You Like It, The Tempest, King Lear or A Winter's Tale). It is used for scenes of everyday life (Bottom and company in A Midsummer Night's Dream; Corin in As You Like It; William, Bates and Court in Henry V); for low comedy (Bottom and company; Touchstone and Audrey in As You Like It; Fluellen and Pistol in Henry V; Sir Toby Belch, Maria and Malvolio in Twelfth Night); and for bantering, relaxed or unbuttoned conversation (Celia, Rosalind and Touchstone in As You Like It; Gower, Fluellen, MacMorris and Jamie in Henry V; Prince Hal and Falstaff in 2 Henry IV).
PLEASE NOTE: it is NOT ACCURATE to say that "the lower classes speak prose and the upper classes speak verse." The highborn cousins Rosalind and Celia speak prose to one another in As You Like It, as do King Henry and Katherine of France in Henry V. Hamlet, Prince of Denmark, tends to use prose both when he is being very rational and when he is very irrational (but the passionate Hamlet speaks in verse). Similarly, when the lower classes figure in serious or romantic situations, they may speak verse (e.g. Silvius and Phebe in As You Like It; the gardeners in Richard II).
RHYME is often used for ritualistic or choral effects and for highly lyrical or sententious passages that give advice or point to a moral (the Duke's speeech at the end of Act 3 in Measure for Measure). Rhyme is used for songs (Amiens in As You Like It; Feste in Twelfth Night; Ariel in The Tempest); in examples of bad verse (the Pyramus and Thisbe play in A Midsummer Night's Dream and Orlando's bad poetry in As You Like It); in Prologues, Epilogues and Choruses (the Chorus in Henry V; Puck's epilogue); in masques (Hymen in As You Like It; Iris, Ceres and Juno in The Tempest) and in plays-within-plays (Pyramus and Thisbe in A Midsummer Night's Dream; the Mousetrap play in Hamlet), where it distinguishes these imaginary performances from the "real world" of the play. It is also used for many manifestations of the supernatural (e.g. the witches in Macbeth; the fairies in A Midsummer Night's Dream; Ariel in The Tempest) -- but not for ghosts (e.g. Hamlet's father), who retain the human use of blank verse.
BLANK VERSE is employed in a wide range of situations because it comes close to the natural speaking rhythms of English but raises it above the ordinary without sounding artificial (unlike the "singsong" effect produced by dialogue in rhyme). Art elevates and distills the everyday; writing in blank verse helps sharpen that distinction. Blank verse, as opposed to prose, is used mainly for passionate, lofty or momentous occasions and for introspection; it may suggest a refinement of character. Many of Shakespeare's most famous speeches are written in blank verse: Macbeth's and Lady Macbeth's plotting; the great soliloquies of Henry V and Hamlet; Caliban's complaints and Prospero's farewell to magic in The Tempest. As noted above, a speech or scene in blank verse may end with a single rhyming couplet known as a capping couplet. It is used to lend a final punch, a concluding flourish or a note of climax to the end of a speech or scene.
When reading a play in written form, it's easy to tell the difference: prose runs all the way to the end of the line and doesn't have capital letters at the start of every line, while in verse (either blank or rhyming) each line usually ends after roughly the same number of syllables and the next line starts with a capital letter.
When seeing a play being performed - at least if it's performed well - it can be hard to distinguish by ear between prose and blank verse, but rhyming verse is more noticeable.
It's interesting to note the historical context here. Shakespeare was writing at just around the time that prose was supplanting verse as the primary means for writing fiction, which explains why we see such a mixture in his plays, as well as why the proportion of prose to verse generally increases from earlier plays to later ones. Quoting from this very informative British Library article:
A mix of [prose and verse] is unusual in much of literature, but commonplace in the plays of Shakespeare and other dramatists of his age. Although we would probably expect a modern play to be written in prose, the practice of English dramatists before Shakespeare was to write in rhyming verse. Poetry was regarded as the chief literary form, although prose was used for some types of storytelling, such as chivalric romances and travellers’ tales. (The novel as we know it didn’t emerge until the 18th century). The use of prose alongside verse was something that gradually crept into English drama towards the end of the 16th century.
Shakespeare’s early comedies make use of both prose and verse, but his first tragedy, the Roman play Titus Andronicus, is – according to convention – written almost entirely in verse, except for Act 4, Scene 3 when Titus has a brief exchange with a simple-minded messenger. The ‘clown’, as he is listed in the dramatis personae, speaks in prose, and at one point Titus, a renowned general in the Roman army, slips into this mode while talking to the clown. Shakespeare wrote Titus Andronicus in 1593–94. By the time he wrote his later tragedies, he was using a much greater proportion of prose, and in Hamlet (composed 1600–01), for example, this is used to telling effect.
The same article also analyses several specific passages taken from The Taming of the Shrew, Much Ado About Nothing, etc. I'll consider a couple of these which focus on places where Shakespeare derived from the usual iambic pentameter scheme.
The quality of mercy is not strain’d,
It droppeth as the gentle rain from heaven
Upon the place beneath. It is twice blest:
It blesseth him that gives and him that takes.
‘Tis mightiest in the mightiest, it becomes
The throned monarch better than his crown.
-- The Merchant of Venice, Act IV Scene I
The third line here ends with two stressed syllables. Rather than being an unintentional slip away from iambic pentameter, this is likely a deliberate technique used to emphasise the words twice blest. Similarly, the paucity of stressed syllables in the fifth line helps to make "might" stand out from the rest of the line, which is another form of emphasis.
More examples can be found in some early scenes of Hamlet, when Hamlet speaks in broken verse with many lines much longer than ten syllables, and towards the end of The Tempest, when Prospero speaks in shorter, iambic tetrameter, lines of verse. Both of these deviations from the norm (the BL article argues) can be interpreted in terms of semantic meaning. Hamlet is cracking up under the stress of his father's death and his mother's distance from him, and this shows in the extended lines which can hardly contain his emotion. Prospero is weakened, having lost his magic, and this shows in the diminished, seven or eight syllable, lines of his final speech.