Why do some sonnets deviate from iambic pentameter?

I suppose it is because some poets chose to change things up a little. For Shakespeare, some think that he changed the way he wrote certain parts of his plays based on a character's motivations... for instance, if a character was rebellious, then the "formal" structure might be changed out a little. In general, the answer is poetic license. Poets change the way they do things in order to improve the poems... that is, unless it was a mistake. For some poets, it might be.