Recap of Riemann's original proof of the dimension of Moduli space $M_g$ I am trying to understand some single steps in this
recap  of Bernhard Riemann's original proof by Alexandre Eremenko
that the moduli space $M_g$
of compact Riemann surfaces with genus $g \ge 2$ has dimension
$3g-3$ (or in original context the $3g-3$ 'degrees of freedom' are
what Riemann called 'moduli')

Riemann combines what is called Riemann-Roch and Riemann-Hurwitz nowadays.
He considers the dimension of the space of holomorphic maps of degree $d$
from the Riemann surface of genus $g$ to the sphere. He computes this dimension
in two ways. By Riemann-Roch this dimension is
$2d-g+1$, for a fixed Riemann surface. (Indeed, Riemann-Roch says that
the dimension of the space of such functions with $d$ poles fixed
is $d-g+1$ (when $d\geq 2g-1$ which we may assume), but these poles can
be moved, so one has to add $d$ parameters).


On the other hand, such a function has $2(d+g-1)$ critical points by
Riemann-Hurwitz. Generically, the critical values are distinct, and can
be arbitrarily assigned, and this gives the dimension of the set of
all such maps on all Riemann surfaces
of genus $g$.


So the space of all Riemann surfaces of genus $g$ must be of dimension
$$2(d+g-1)-(2d-g+1)=3g-3.$$

There are essentially two things I struggle with.
Point 1: Why the dimension of the space of holomorphic maps
of degree $d$ from the Riemann surface $S$ of genus $g$ to the sphere
equals $2d-g+1$?
As far as can follow we are going to apply RR. Let $h$ any
holomorphic map $S \to \mathbb{P}^1$ of degree $d$ which we regard as
meromorphic function $h$ which behaves compatible with degree $d$ in
it's poles and zeros, set $(h) :=D$ and apply RR to it.
RR tells $l(D)= d -g+1$ where $l(D)$ is the $C$-dimension of
meromorphic functions $f$ on $S$
such that all the coefficients of the divisors $(f) + D$ are non-negative.
Eremenko argues then that the additional $d$ dimensions
we obtain because 'the poles of can be moved, so one has to
add $d$ parameters.'
I not understand why moving of the $d$ poles gives additionally exaxt
$d$ parameters.
Point 2: Why the difference
$$ 2(d+g-1)-(2d-g+1) $$
between the number of critical points of these moromorphic functions
(that's Riemann-Hurwitz-Thm) and the counted dimension of
the space of holomorphic maps of degree $d$ from point 1 gives exactly
the dimension of the moduli?
 A: *

*To specify a degree $d$ map $f: X \to \mathbb{P}^1$, one first chooses an effective divisor $D$ of degree $d$ to specify the poles of $f$. Since $D$ has support consisting of $d$ points, this amounts to $d$ choices. So this by this "the poles can be moved" comment, he means that choosing a different divisor $D'$ will result in a different map with poles given by the support of $D'$ instead. Then one computes $\ell(D)$ as you have described above to get the dimension of the space of degree $d$ maps $f: X \to \mathbb{P}^1$ with $\renewcommand{\div}{\operatorname{div}} \div_\infty(f) = D$.


*We want to compute the dimension of $\mathcal{M}_g$, the moduli space of curves of genus $g$, but what we've really done is computed the dimension of the moduli space of pairs $(X,f)$ where $X$ is a curve of genus $g$ and $f$ is a degree $d$ map $X \to \mathbb{P}^1$. This related moduli space is called a Hurwitz space, denoted $\DeclareMathOperator{\Hur}{Hur} \Hur_{d,g}$. In order to remove this choice of a map $f: X \to \mathbb{P}^1$, we subtract off the dimension of the space of degree $d$ maps $X \to \mathbb{P}^1$ which was computed above.
You can interpret this using the projection
\begin{align*}
\pi: \Hur_{d,g} &\to \mathcal{M}_g\\
(X,f) &\mapsto X \, .
\end{align*}
We've computed the dimension of $\Hur_{d,g}$ and, for a given $X$, the dimension of the fiber $\pi^{-1}(X)$. Assuming $\pi$ is sufficiently "nice", we should have
\begin{align*}
\dim(\mathcal{M}_g) = \dim(\Hur_{d,g}) - \dim(\pi^{-1}(X)) = 2d + 2g - 2 - (2d - g + 1) = 3g-3 \, ,
\end{align*}
as desired.
This is covered in greater detail in chapter 2, section 3 (p. 255) of Principles Of Algebraic Geometry by Griffiths and Harris. Jarod Alper also recently covered this in a lecture for a course he's teaching, which you can watch here. (See here for the dimension calculation you've asked about.)
