The opening line, often used as the title for Sonnet 29, establishes a desolate tone through word choice, caesura, conditional clauses, and alliteration.
Shakespeare's sonnets are numbered 1–154. Sonnet 29 doesn't leave much room for interpretation as this is just the twenty-ninth sonnet in the chronological order of publication.
Because scholars often need a more definite point of reference when discussing Shakespeare's sonnets, they often use the first line as the title. Therefore, this sonnet is often called "When, in disgrace with fortune and men's eyes." This does leave room for personal interpretation.
First, this line sets a despairing tone for the opening of the sonnet. The word "disgrace" establishes a feeling of disappointment, while "men's eyes" establishes a feeling of being evaluated by others and falling short.
The poem also begins with an example of caesura; the comma after when indicates that the line should be read slowly. The pacing mimics the speaker's belief that he is completely isolated and has nowhere to turn in this opening line.
When also establishes a conditional clause. There are actually many conditions linked to this initial word. (To paraphrase—"When I am alone, when I trouble heaven, when I curse my fate, when I wish to be someone else, when I desire someone else's talents," and so forth.) All of these conditions focus on the speaker's introspective evaluation of himself, and he believes that he always falls short of a standard to which he compares himself. This, of course, will shift.
There is also a repetitive echo of the n sound in this initial line, heard in When, in, fortune, and men. This alliteration is a harsh sound, contributing to the grim tone and forcing a halting cadence.