The sonnet is a traditionally rigid poetic form featuring fourteen lines with rhyme, meter, and logical structure. The form was first developed in Italy during the High Middle Ages, with such well-known figures as Dante Alighieri putting it to use. But the most famous sonneteer of that time was Francesco Petrarca, and it is after him that the Italian sonnet got its name.
The Petrarchan sonnet's fourteen lines are divided into an octave (eight lines) and a sestet (six lines), with the sestet responding to some proposition introduced in the octave. The rhyme scheme varied somewhat, but typically featured no more than four or five rhymes, for example abbaabba cdecde.
Thomas Wyatt introduced the sonnet form into the English language in the early 16th century. Although Wyatt stuck to Petrarchan conventions, the form soon evolved into a specifically English one, and it was used by a good number of Renaissance poets - including Shakespeare. In fact, the English sonnet is often referred to as the Shakespearean sonnet for the same reason the Italian sonnet is often named after Petrarch. It is also sometimes referred to as the Elizabethan sonnet, after the era during which it took shape.
The Shakespearean sonnet is distinct from the Petrarchan sonnet in a number of ways. First, the octave-sestet division is replaced by a quatrain-couplet division, with three quatrains of four lines each followed by a closing two-line couplet. The rhyme scheme of a traditional Shakespearean sonnet is abab cdcd efef gg, increasing the total number of rhymes to seven. The meter is iambic pentameter, five feet of two syllables each (ten syllables total per line), where each foot is normally an iamb consisting of an unstressed syllable followed by a stressed one. Finally, the logical structure of a Shakespearean sonnet parallels that of the Petrarchan to a certain extent, in that the third quatrain sometimes introduces a twist on the theme of the preceding two; but it is the distinctive couplet that carries the pop, normally delivering a great overarching message or a deeply insightful thought.