Apologies if this is not quite at the level of MathOverflow, but it has already been asked at MSE and gone unresolved for several years despite a bounty.

Hartshorne states the theorem as follows:

Proposition IV.6.1. A curve $X$ of genus $g\geq 2$ has a nonspecial very ample divisor $D$ of degree $d$ if and only if $d\geq g+3$.

The necessity is shown, and then sufficiency. The idea is to show that the set $S$ of divisors $D \in X^d$ such that there exists $D' \sim D$ and points $P,Q \in X$ with $E = D'-P-Q$ an effective special divisor has dimension $\leq g+2$. Because $d\geq g+3$ this means there is some $D\notin S$ that is nonspecial and very ample of degree $d$.

Hartshorne shows that the set of divisors of the form $E+P+Q$ in $X^d$ that are nonspecial with $E$ a special effective divisor has dimension $\leq g+1$.

The part that confuses me comes afterwards. Namely, as $E$ is special the Riemann-Roch tells us that $\dim |E| \geq d-1-g$, and similarly that $\dim |E+Q+P| = d-g$. Because the difference between these two dimensions is at most 1, this somehow implies that the set of divisors $S$ as above has dimension $\leq g+2$.

I don't understand this implication. We have divisors of the form $E+Q+P$, each of which gives a linear system of dimension $d-g$, and all of which form a set of divisors of dimension $\leq g+1$. How does the difference in dimension of $E$ and $E+P+Q$ tell us the dimension of $S$?