Solution (source code)

= Solution

The central <matrices> $\pm I$ act identically on the <complex upper half-plane>, so the effective group is $\mathrm{PSL}_2(\mathbb Z)$. Away from points with nontrivial effective stabilizer, properly discontinuous action supplies ordinary quotient-disc charts. At a fixed point $z_0$, the coordinate $u=(\tau-z_0)/(\tau-\overline z_0)$ identifies the stabilizer action with a rotation; its invariant coordinate is $u^e$, where $e$ is the effective stabilizer order. These charts give the quotient its <Riemann surface> structure.

The <elliptic stabilizers of the modular group> occur only in the orbits of $i$ and $\omega=e^{2\pi i/3}$. They have effective orders two and three. Consequently \b[the <analytic ramification indices> of the map from the half-plane are]
$$
\boxed{e=2\text{ over the orbit of }i,\qquad e=3\text{ over the orbit of }\omega,\qquad e=1\text{ elsewhere}.}
$$
The stabilizers in $\mathrm{SL}_2$ have orders four and six, but the central factor does not double these indices.

All rational boundary points, including infinity, lie in one <cusp of a modular group>: a primitive column $(a,c)$ can be completed to a determinant-one integral <matrix> taking infinity to $a/c$. The stabilizer of infinity is generated effectively by $T:\tau\mapsto\tau+1$, and the coordinate $q=e^{2\pi i\tau}$ identifies its high horodisc quotient with a punctured disc. Adding $q=0$ fills that disc. This constructs the <compactified modular curve> from the extended half-plane; it does not use the ordinary subspace topology on the rational boundary.

For compactness use the <standard fundamental domain of the modular group>. Its part below a fixed height $Y>1$ is compact, since its imaginary part is at least $\sqrt3/2$. The part above $Y$, modulo translation and with the <modular cusp> added, is a closed disc in the $q$-coordinate. Their images cover the quotient, so it is compact. The same argument with finitely many translates proves compactness for every finite-index <subgroup>.