Let $X$ be a smooth projective curve and $D$ and effective divisor on it. The normal bundle of $D$ is defined as $$ \mathscr{O}_D(D)\; = \; \mathscr{O}_x(D)\;\otimes_{\mathscr{O}_X}\, \mathscr{O}_D$$ where $\mathscr{O}_D$ is just the restriction of the stricture sheaf of $X$ to the support of $D$. In the literature I found the claim that, as a special case of Serre's duality, the dual space to $H^0(X, \mathscr{O}_D(D))$ is $$ H^0(X, \mathscr{O}_D(D))^* \cong H^0(X,K\otimes\mathscr{O}_D), $$ where $K$ is the canonical sheaf.
Now, I'm not an expert of Serre's duality, but I was expecting the dual of that space to be something like $$ H^0(X,(K-D)\otimes\mathscr{O}_D). $$ Could you please explain the reason why the above is the right answer and mine is the wrong one?
Let $X$ be a smooth projective curve and $D$ and effective divisor on it. The normal bundle of $D$ is defined as $$ \mathscr{O}_D(D)\; = \; \mathscr{O}_x(D)\;\otimes_{\mathscr{O}_X}\, \mathscr{O}_D$$ where $\mathscr{O}_D$ is just the restriction of the stricture sheaf of $X$ to the support of $D$. In the literature I found the claim that, as a special case of Serre's duality, the dual space to $H^0(X, \mathscr{O}_D(D))$ is $$ H^0(X, \mathscr{O}_D(D))^* \cong H^0(X,K\otimes\mathscr{O}_D), $$ where $K$ is the canonical sheaf.
Now, I'm not an expert of Serre's duality, but I was expecting the dual of that space to be something like $$ H^0(X,(K-D)\otimes\mathscr{O}_D). $$ Could you please explain the reason why the above is the right answer and mine is the wrong one?
From Proposition 8.20 of Hartshorne (chapter II, page 182), we have a formula for the canonical sheaf $\omega_D$ of $D$: $$ \omega_D = \omega_X \otimes \mathscr{O}_D(D). $$ So applying Serre's duality for $D$ we find $$ H^0(\mathscr{O}_D(D))^* \cong H^0(\omega_D \otimes \mathscr{O}_D(D)^{-1}) \cong H^0(\omega_X \otimes\mathscr{O}_D(D)\otimes \mathscr{O}_D(D)^{-1}) \cong H^0(\omega_X \otimes \mathscr{O}_D). $$
###UPDATE:
To make the notation easier let's use the following shorthands: $$H^0(D) \leadsto H^0(X,\mathcal{O}_X(D)) \quad\text{ and }\quad H^0(D_D) \leadsto H^0(X,\mathcal{O}_X(D)\otimes \mathcal{O}_D)$$ I'd like to point out that once one proves (like in the original book of Serre Algebraic Groups and Class Fields) that for every divisor $D$ we have $$ H^1(D)^{\vee} \cong H^0(K-D), $$ then the above duality between $H^0(D_D)$ and $H^0(K_D)$ follows by abstract nonsense, without using the adjunction formula. Indeed from the short exact sequences of invertible sheaves $\newcommand{\SES}[3]{ 0 \to #1 \to #2 \to #3 \to 0 }$ $$ \SES{\mathscr{O}_X}{\mathscr{O}_X(D)}{\mathscr{O}_X(D)\otimes \mathscr{O}_D} $$ and $$ \SES{K(-D)}{K}{K\otimes \mathscr{O}_D} $$ we get the commutative diagram with exact rows $$ \newcommand{\ra}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xrightarrow{\quad#1\quad}\!\!\!\!\!\!\!\!} \newcommand{\la}[1]{\!\!\!\!\!\!\!\!\!\!\!\!\xleftarrow{\quad#1\quad}\!\!\!\!\!\!\!\!} \newcommand{\da}[1]{\left\downarrow{\scriptstyle#1}\vphantom{\displaystyle\int_0^1}\right.} % \begin{array}{llllllllllll} 0 & \;\;\ra{} \;& k & \;\ra{} & H^0(D) & \;\;\ra{} & H^0(D_D) & \;\;\ra{} & H^1(\mathscr{O}_X) & \;\;\ra{} & H^1(D) & \;\;\ra{} & 0 \\ & & \da{\;f_0} & & \da{\;f_1} & & \da{\;f_2} & & \da{\;f_3} & & \da{\;f_4} & & \\ 0 & \;\;\ra{} \;& k & \;\ra{} & H^1(K-D)^{\vee} & \;\;\ra{} & H^0(K_D)^{\vee} & \;\;\ra{} & H^0(K)^{\vee} & \;\;\ra{} & H^0(K-D)^{\vee} & \;\;\ra{} & 0 \\\end{array} $$ where $f_0$, $f_1$, $f_3$ and $f_4$ are the duality isomorphisms. Using the 5 lemma we can now deduce that $f_2$ is an isomorphism as well.
Remark: we are just using the hypothesis of Serre duality from Serre's book, so that $X$ is a smooth projective curve over an algebraically closed field.