[step:Compute the rank by reducing modulo $\mathfrak{m}_q$]Reducing $B \cong A^{\oplus r}$ modulo $\mathfrak{m}_q$ — that is, tensoring with the residue field $\kappa(q) = A/\mathfrak{m}_q = k$ (using that $k$ is algebraically closed and $q$ is a $k$-point) — we obtain
\begin{align*}
B \otimes_A k = B / \mathfrak{m}_q B \cong k^{\oplus r}.
\end{align*}
We compute the left-hand side directly. Let $\mathfrak{m}_i := \mathfrak{m}_{p_i} \cap B$ be the maximal ideals of $B$. The maximal ideals of $B$ are exactly the $\mathfrak{m}_i$, $i = 1, \ldots, k$, and they are pairwise coprime (any two distinct maximal ideals of a commutative ring are coprime).
\textbf{Identify $\mathfrak{m}_q B$ as a principal ideal.} Let $t \in \mathfrak{m}_q$ be a uniformiser of $A$, so that $\mathfrak{m}_q = (t)$ as an ideal of $A$ (this uses that $A$ is a DVR, hence $\mathfrak{m}_q$ is principal). Then $\mathfrak{m}_q B = (\varphi^* t)$ in $B$: an ideal extension from a principal ideal is principal, generated by the image of the generator.
\textbf{Order of $\varphi^* t$ at each $p_i$.} In the localisation $B_{\mathfrak{m}_i} = \mathcal{O}_{C, p_i}$, the ramification index is defined by
\begin{align*}
\operatorname{ord}_{p_i}(\varphi^* t) = e_{p_i},
\end{align*}
by the very definition of the ramification index (the statement of the theorem). Hence in $\mathcal{O}_{C, p_i}$, the element $\varphi^* t$ generates the ideal $\mathfrak{m}_{p_i}^{e_{p_i}}$, i.e.\ $(\varphi^* t) \mathcal{O}_{C, p_i} = \mathfrak{m}_{p_i}^{e_{p_i}}$.
\textbf{Factor $(\varphi^* t)$ in the semilocal Dedekind ring $B$.} Since $B$ is a semilocal Dedekind domain with maximal ideals $\mathfrak{m}_1, \ldots, \mathfrak{m}_k$, every nonzero ideal of $B$ factors uniquely as a product of prime powers. The ideal $(\varphi^* t)$ has, locally at $\mathfrak{m}_i$, valuation $e_{p_i}$, so its unique factorisation is
\begin{align*}
(\varphi^* t) = \prod_{i=1}^{k} \mathfrak{m}_i^{e_{p_i}} = \bigcap_{i=1}^{k} \mathfrak{m}_i^{e_{p_i}},
\end{align*}
where the second equality holds because the $\mathfrak{m}_i^{e_{p_i}}$ are pairwise coprime (distinct maximal ideals are coprime, and powers of coprime ideals are coprime — see the guided block).
\textbf{Apply CRT.} We invoke the *Chinese Remainder Theorem* for commutative rings: if $I_1, \ldots, I_k$ are pairwise coprime ideals of a commutative ring $R$, then the natural map $R / \bigcap_i I_i \to \prod_i R / I_i$ is a ring isomorphism. Hypotheses: $B$ is a commutative ring, and the ideals $\mathfrak{m}_i^{e_{p_i}}$ are pairwise coprime. Hence
\begin{align*}
B / \mathfrak{m}_q B = B / (\varphi^* t) = B / \bigcap_{i=1}^{k} \mathfrak{m}_i^{e_{p_i}} \cong \prod_{i=1}^{k} B/\mathfrak{m}_i^{e_{p_i}}.
\end{align*}
\textbf{Localisation is harmless modulo $\mathfrak{m}_i^{e_{p_i}}$.} The localisation map $\lambda_i : B \to B_{\mathfrak{m}_i} = \mathcal{O}_{C, p_i}$ descends to a map $\bar\lambda_i : B/\mathfrak{m}_i^{e_{p_i}} \to \mathcal{O}_{C, p_i}/\mathfrak{m}_{p_i}^{e_{p_i}}$. We verify it is an isomorphism:
\emph{Surjectivity.} Take any $[\alpha/\beta] \in \mathcal{O}_{C, p_i}/\mathfrak{m}_{p_i}^{e_{p_i}}$ with $\alpha \in B$, $\beta \in B \setminus \mathfrak{m}_i$. Since $\beta \notin \mathfrak{m}_i$, its image $\bar\beta \in B/\mathfrak{m}_i^{e_{p_i}}$ is a unit: the ring $B/\mathfrak{m}_i^{e_{p_i}}$ is local with maximal ideal $\mathfrak{m}_i/\mathfrak{m}_i^{e_{p_i}}$, so an element is a unit iff it is not in $\mathfrak{m}_i$. Hence there exists $\bar\gamma \in B/\mathfrak{m}_i^{e_{p_i}}$ with $\bar\beta \bar\gamma = 1$, and $\bar\alpha \bar\gamma \in B/\mathfrak{m}_i^{e_{p_i}}$ maps to $[\alpha/\beta]$.
\emph{Injectivity.} If $\bar\lambda_i([x]) = 0$ for some $x \in B$, then $x \in \mathfrak{m}_{p_i}^{e_{p_i}} \cap B$. Since $B_{\mathfrak{m}_i} = \mathcal{O}_{C, p_i}$, $\mathfrak{m}_{p_i}^{e_{p_i}} = \mathfrak{m}_i^{e_{p_i}} B_{\mathfrak{m}_i}$. An element of $B$ lies in $\mathfrak{m}_i^{e_{p_i}} B_{\mathfrak{m}_i} \cap B$ iff it lies in $\mathfrak{m}_i^{e_{p_i}}$ (using that $B$ is a Dedekind domain and the primary decomposition of $(x)$ at $\mathfrak{m}_i$ has $\mathfrak{m}_i$-part contained in $\mathfrak{m}_i^{e_{p_i}}$). Hence $x \in \mathfrak{m}_i^{e_{p_i}}$, i.e.\ $[x] = 0$.
Combining:
\begin{align*}
B / \mathfrak{m}_q B \cong \prod_{i=1}^{k} B/\mathfrak{m}_i^{e_{p_i}} \cong \prod_{i=1}^{k} \mathcal{O}_{C, p_i}/\mathfrak{m}_{p_i}^{e_{p_i}}.
\end{align*}
The $k$-vector space $\mathcal{O}_{C, p_i} / \mathfrak{m}_{p_i}^{e_{p_i}}$ has dimension $e_{p_i}$: a basis is given by $1, s_i, s_i^2, \ldots, s_i^{e_{p_i} - 1}$, where $s_i \in \mathfrak{m}_{p_i}$ is a uniformiser, by the structure theorem for the residue ring of a discrete valuation ring modulo $\mathfrak{m}_{p_i}^{e_{p_i}}$. Summing:
\begin{align*}
\dim_k (B / \mathfrak{m}_q B) = \sum_{i=1}^{k} e_{p_i}.
\end{align*}[/step]