What's he saying?
"Farewell! thou art too dear for my possessing / And like enough thou know'st thy estimate:"
Farewell! You are too precious for me to possess; you yourself likely know how precious you are:
"The charter of thy worth gives thee releasing; / My bonds in thee are all determinate."
Your preciousness gives you the privilege of being set free from me; your responsibilities to me are not forever.
"For how do I hold thee but by thy granting? / And for that riches where is my deserving?"
For how have I managed to keep you, other than by your permission? And how have I deserved your preciousness?
"The cause of this fair gift in me is wanting / And so my patent back again is swerving."
There is no good reason for you to have given yourself to me, and you are regaining control over your ability to choose whom to give yourself to.
"Thy self thou gavest, thy own worth then not knowing / Or me, to whom thou gavest it, else mistaking;"
You gave yourself to me when you did not know how precious you were; or perhaps you did so because you misjudged me, to whom you gave yourself, as more worthy than I am;
"So thy great gift, upon misprision growing / Comes home again, on better judgment making."
And so your great gift, having grown from that misjudgment, now returns to its owner (you yourself), now that your judgment has improved.
"Thus have I had thee, as a dream doth flatter / In sleep a king, but waking no such matter."
And so I have had you like a dream, flattering me as though I were a king, but in reality I never was.
Why is he saying it?
Sonnet 87 is the first sonnet after the rival poet sequence (sonnets 79-86). It begins a new sequence of sonnets dealing with the narrator's "breakup" with the fair lord. The first word captures the essence of the sonnet precisely: "Farewell!" Immediately we are reintroduced to the theme of self-deprecation and inadequacy that was especially predominant in the preceding rival poet sequence: "thou art too dear for my possessing." This sentiment is repeated again and again throughout the sonnet, e.g. in line 6: "And for that riches where is my deserving?" The narrator thereby acknowledges his unworthiness and presents that as justification for the fair lord's rejection.
The narrator sees two possible explanations for how he ever managed to obtain the fair lord's attention in the first place: either the fair lord was not then aware that he was too good for the narrator, or he had not yet realized that the narrator was not good enough for him. In any case, the narrator's love for the fair lord was not realistic, for it took on the character of a dream. Note the abundance of feminine rhyme (end rhymes of at least two syllables with the final syllable unstressed), the repetition of the -ing suffix resulting in uncharacteristic monotony, and the fact that almost all of the lines in the sonnet have 11 syllables; perhaps the poet's farewell to the fair lord is hereby symbolized in his abandonment of the poetic conventions he once relied on for sonnets of praise.
Beyond the theme of self-deprecation and inadequacy, sonnet 87 also contains some excellent examples of Shakespeare's frequent use of the imagery of financial bondage. As with the court imagery found in sonnet 30, this theme often takes on the form of legal metaphors, here seen in the words "charter," "patent," and "misprision." Meanwhile from the language of finance are the words "estimate," "worth," "bonds," and "riches."
Lines 3-4, for example, offer some good discussion of the theme of financial bondage. Following the poet's characterization of the fair lord as "too dear for my possessing," he describes the fair lord's preciousness as such that it grants him certain privileges, as a charter would a corporation, including the privilege to declare himself free of all obligations. The narrator's bonds, or financial obligations, with the fair lord are thereby becoming null and void; the fair lord is free of commitment by mere virtue of his dearness, being more worthy than the narrator. Shakespeare may have chosen this imagery simply for the sake of metaphor, or perhaps there is in fact some deeper meaning to it: perhaps the fair lord was indeed the poet's financial benefactor, but is now freed from that obligation having chosen to take his business elsewhere.