Sonnet 29 is all about love's power to bring optimism and hope to one who feels lonely and depressed. The first two lines of the sonnet perfectly capture his feelings:
"When in disgrace with fortune and men’s eyesI all alone beweep my outcast state" (1-2).
The majority of the sonnet focuses on the speaker's problems: he wishes he were more wealthy, that he had more friends, that he were more artistic, or had the opportunities that another man might have. The first eight lines completely focus on this 'why me?' bemoaning of the speaker's situation in life.
In the final six lines, however, the speaker's tone changes in this pivotal moment "yet in these thoughts myself almost despising, haply I think on thee," and the mood of the poem completely shifts with the sound of birdsong and the imagery of heaven's gates. Shakespeare's "Sonnet 29" addresses the healing power of love to lift one's spirits when all else seems completely futile and depressing.
While Sonnet XXIX has the rhyme scheme of a Shakespearean sonnet, its thematic format is that of the Petrarchan sonnet in which the octave states the problem: the brooding poet senses his misfortune as he curses his fate and wishes he could possess the artistic talents and friends that others do, all of which would greatly lift his spirits,
When in disgrace with fortune and men's eyes,
I all alone beweep my outcast state....
Wishing me like to one more rich in hope--
Then, the sestet provides a solution to his dark broodings when he reflects on the fortunate aspects of his life as he "haply" dwells on the love bestowed upon him and his spirits lift,
Haply, I think on thee,--and then my state...
...sings hymn's at heaven's gate.
With the love of the woman, the speaker is relieved of his isolation and is no longer alone; now there is meaning in his life, and thus fortified by love, he can again be optimistic.