Proof (fundamental group of compact connected surfaces)

The sphere

Embedding $S^2 = \sb{x\in \R^3}{|x| = 1}$, consider the open cover $$ \begin{align*} S^2 = \underbrace{(S^2 \setminus \set{(0,0,1)})}_{U} \cup \underbrace{(S^2 \setminus \set{(0,0,-1)})}_{V}. \end{align*} $$ $U$ and $V$ are homeomorphic to $D^2$, which is contractible so simply connected. The intersection $U\cap V$ is $\set{-1<z<1}\cap S^2$, which is path-connected. Therefore by Seifert van-Kampen, $$ \begin{align*} π_1(S^2, *) \isom π_1(U, *) *_{π_1(U\cap V, *)} π_1(V, *) \isom 1 * 1 = 1 \end{align*} $$

Orientable surfaces

Let $T^0$ be a torus with an open triangle removed. By stretching the triangle, $T^0$ deformation retracts to $S^1 \vee S^1$, inducing $$ \begin{align*} π_1(T^0, x_0) &\xrightarrow{\sim} \langle a,b\mid\rangle \\ [r] &\mapsto aba\inv b\inv \end{align*} $$ where $r$ is the boundary of the triangle.

Glue $g$ copies of $T^0$ together along edges of triangles with a common vertex $x_0$ to form $Σ_{g,\partial}$, and call the old boundary loops $r_1, r_2, \ldots, r_g$. Each $T^0$ is then a closed subset of $Σ_{g,\partial}$, and the intersection of consecutive $T^0$ is a line segment. By Seifert-van Kampen, since the intersection is a neighbourhood deformation retract and is simply connected, $$ \begin{align*} π_1(Σ_{g,\partial}, x_0) &\xrightarrow{\sim} π_1(T^0, x_0) * \ldots * π_1(T^0, x_0) \isom \langle a_1, b_1, \ldots, a_g, b_g\rangle \\ [r_1 \cdot r_2 \cdot \ldots \cdot r_g] &\mapsto a_1 b_1 a_1\inv b_1\inv \ldots a_g b_g a_g\inv b_g\inv. \end{align*} $$

Now attach a 2-cell along the boundary $r_1 \cdot r_2 \cdot \ldots \cdot r_g$ to obtain $Σ_g$. Then $$ \begin{align*} π_1(Σ_g, x_0) \isom π_1(Σ_{g,\partial}, x_0) / \langle \langle [r_1\cdot \ldots\cdot r_g]\rangle\rangle = \langle a_1, b_1, \ldots, a_g, b_g \mid \prod_{i=1}^{g} a_i b_i a_i\inv b_i\inv\rangle. \end{align*} $$

Non-orientable surface

Let $M$ be $\mathbb{RP}^2$ with an open triangle removed (i.e. a Möbius strip). By stretching the triangle, $M$ deformation retracts to $S^1$, inducing $$ \begin{align*} π_1(M, x_0) &\xrightarrow{\sim} \langle a\mid\rangle \\ [r] &\mapsto a^2 \end{align*} $$ where $r$ is the boundary of the triangle.

As before, glue $k$ copies together along the boundary segments to form $S_{k,\partial}$. Then $$ \begin{align*} π_1(S_{k,\partial}, x_0) &\xrightarrow{\sim} \langle a_1, \ldots, a_g\mid\rangle \\ [r_1 \cdot \ldots \cdot r_k]& \mapsto a_1^2 \ldots a_k^2. \end{align*} $$ Attach a 2-cell to close the boundary and obtain $S_k$. We get $$ \begin{align*} π_1(S_k, x_0) \isom π_1(S_k, x_0)/\langle \langle [r_1\cdot \ldots\cdot r_g]\rangle\rangle \isom \langle a_1, \ldots, a_g, \prod_{i=1}^{k} a_i^2\rangle \end{align*} $$