This is one of Shakespeare's more famous sonnets and is thought to be part of the "Fair Youth" set of sonnet. It is believed Shakespeare was addressing a young man of whom he was fond--perhaps a lover, more likely a friend. The style is a Petrarchian sonnet, written about love and presenting a problem in the first two quatrain, a shift in thought in the third quatrain, and a resolution of sorts in the rhyming couplet at the end.
The first quartrain begins with a rhetorical question--"Shall I compare thee to a summer's day?" Shakespeare's response is in line two--the person to whom this poem is addressed is more beautiful and more temperate--more balanced--than a summer day. Lines three and four discuss the ephemeral nature of beauty and summer--wind comes and strips the tree of its beautiful May flowers, and summer days eventually turn to fall.
Quatrain two continues the theme that good and beautiful things cannot be good and beautiful forever. Shakespeare writes of "the hot eye of heaven"--the sun--is sometimes too hot and other times is hidden by clouds--"his gold complexion dimm'd." (lines 5 and 6.) Lines 7 and 8 discuss how everything beautiful will lose its beauty ("fair from fair sometime declines," in this instance "fair" meaning "beauty"). This will happen by chance (or misfortune) or by nature's natural course ("nature's changing course untrimm'd".)
Line nine notifies the read of the shift in thought with the word "but." The person to whom the poem is written is told in lines 9 and 10 that his/her beauty will not fade, like the natural things mentioned above--"thy eternal summer shall not fade/nor lose possession of that fair (beauty) thou owest." Death will not even take this lover away (line 11) because Shakespeare is immortalizing the lover in this poem (line 12.)
The resolution in the couplet is that as long as there are people on the Earth (line 13), this poem will exist, and the lover will remain immortal and be remembered in it.
So, the overall theme is that beauty usually fade; however, the beauty of Shakespeare's beloved will last forever because Shakespeare immortalized it in a poem.