In the sonnet's first nine lines the speaker is despondent and depressed. He feels he is an "outcast," and unfortunate ("in disgrace with fortune"). He cries out to heaven in his despair, but feels that heaven is "deaf" and does not hear him. He curses himself and begins to compare himself with other people, wishing that he was more like the hopeful people he knows. He eyes other people enviously, wishing he had this man's friends and that man's artistic talent. All of this makes him feel discontented, even with the things he normally enjoys, and he ends up almost despising himself.
But then, he remembers his beloved, and his mood changes almost instantly. In line ten, he addresses his beloved directly as he says "Haply I think on thee." As he does so, his "state" alters to feeling suddenly uplifted, and he likens himself to lark singing at daybreak after a long night. He ends by saying that his beloved's love brings such "wealth" to him that he wouldn't trade places with a king.
In a nutshell, the narrator goes from dwelling on the negative—everything other people have that he wishes he had—to the positive as he remembers what he does have: his beloved, an incomparable treasure. He ends the poem with:
For thy sweet love remembered such wealth brings
That then I scorn to change my state with kings.