Hilbert polynomial of an hypersurface in projective space
Let $X$ an hypersurface in $\mathbb{P}^{n}$ of degree $d$. I would like to prove that the Hilbert polynomial of $X$ is
$\qquad \qquad \qquad \qquad \qquad \qquad p(n)= \begin{pmatrix} n+r \\ n \end{pmatrix} - \begin{pmatrix} n+d-r \\ n \end{pmatrix} $
In the book "Geometry of Algebraic Curves Vol. II", Arbarello, Cornalba, Griffith, p. 7, I read that this result can be proved by taking the cohomology of the following exact sequence
$ \qquad \qquad \qquad \qquad \qquad 0 \longrightarrow \mathcal{O}_{\mathbb{P}^{r}}(n-d) \longrightarrow \mathcal{O}_{\mathbb{P}^{r}}(n) \longrightarrow \mathcal{O}_{\mathbb{P}^{r}}(d) \longrightarrow 0 $
Nevertheless, I am not able to compute $p(n)$.
1) Non-cohomological approach:
First, the Hilbert function $h_X:\mathbb{Z} \to \mathbb{Z}$ is defined as
$$h_X: d \mapsto \dim_kS(X)^{(d)}$$
for a projective subscheme $X \subset \mathbb{P}^n,$ where $S(X)$ is the homogeneous coordinate ring of $X$ (which is a graded ring) and $S(X)^{(d)}$ is the homogeneous degree $d$ part of it, which is a finite dimensional vector space over $k.$ Also $h_X(d)=0$ for $d<0.$
Exercise: Show that $h_X(d)=\binom{n+d}{d}$ for $X=\mathbb{P}^n$ and note that $h_X(d)$ is a polynomial in $d$ of degree $n.$
It turns out that for $d \gg 0$ the Hilbert function $h_X(d)$ can be viewed as a polynomial in $d$ called the Hilbert polynomial $p_X(d).$ (Harder exercise!) (Of course, $d \gg 0$ means relatively big enough.) So finding the Hilbert function helps us a lot in order for finding the Hilbert polynomial.
Now, let $X$ be a hypersurface in $\mathbb{P}^n$ given by a degree $r$ homogeneous polynomial $f$ i.e. $X=\text{Proj}k[x_0,\cdots,x_n]/(f).$ You can easily show that
$$\dim_kS(X)^{(d)}=\dim_k k[x_0,\cdots,x_n]^{(d)}-\dim_k k[x_0,\cdots,x_n]^{(d-r)}$$
Therefore, $h_X(d)=\binom{n+d}{d}-\binom{n+d-r}{d-r}$ which is already a polynomial in $d$ so has to be equal to $p_X(d).$
2) Cohomological approach:
The Hilbert polynomial can also be defined as
$$p_X(d)=\chi(\mathcal{O}_X(d))=\sum_{i=0}^n \dim_k (-1)^iH^i(X,\mathcal{O}_X(d))$$
when $d \gg 0$ for a pojective subscheme $X$ of $\mathbb{P}^n.$
As before, assume $X$ is a hypersurface given by a degree $r$ homogeneous polynomial $f$ in $\mathbb{P}^n.$
The correct setting is to first consider the following SES
$$0 \longrightarrow \mathcal{O}_{\mathbb{P}^n}(-r) \stackrel{.f}{\longrightarrow} \mathcal{O}_{\mathbb{P}^n} \longrightarrow \mathcal{O}_X \longrightarrow 0$$
then twist it by $\mathcal{O}(d)$ to get
$$0 \longrightarrow \mathcal{O}_{\mathbb{P}^n}(d-r) \longrightarrow \mathcal{O}_{\mathbb{P}^n}(d) \longrightarrow \mathcal{O}_X(d) \longrightarrow 0$$
Now, since Euler characteristic $\chi$ is additive on SES, we'd have
$$\chi(\mathcal{O}_X(d))=\chi(\mathcal{O}_{\mathbb{P}^n}(d))-\chi(\mathcal{O}_{\mathbb{P}^n}(d-r)).$$
Using the famous knowledge of sheaf cohomology of $\mathcal{O}_{\mathbb{P}^n}(d)$ you should be able to get the same polynomial for $d \gg 0$ as before.