degree of line bundle as an integral We consider the compact Riemann surface $\mathbb{P}^1$ (my notation for the Riemann sphere). I make an open cover $\mathcal{U} = \{U_1, U_2\}$ where $U_1 = \{z \in \mathbb{C} | |z| < 1+ \epsilon\}$ and $U_2 = \{z \in \mathbb{P}^1 | |z| > 1- \epsilon\}$. Let $L \to X$ be the line bundle on $\mathbb{P}^1$ that is determined by some transition function $g_{12} : U_1 \cap U_2 \to \mathbb{C}^*$. In other words, if $h_1: L_{U_1} \to U_1 \times \mathbb{C}$ and $h_2: L_{U_2} \to U_2 \times \mathbb{C}$ are the local trivialisations of this line bundle (and the line bundle is fully determined by the transtion function), then $h_1 \circ h_2^{-1} (x, t) = (x, g_{12}(x) t)$. 
Now I want to show that 
$\deg L = \frac{1}{2\pi i} \int_{|z| = 1} \frac{g_{12}'(z)}{g_{12}(z)}dz$.
Of course, $\deg L = deg(D)$ where $D$ is the divisor of a meromorphic section $s$ of $L$ over $X$. 
I'm not sure where to begin...the $2\pi i$ reminds me of the residue theorem, and degree feels like Riemann-Roch but I don't know where to go....may I please have some help?
This is question 29.2 of Forster's Lectures on Riemann Surfaces. 
 A: (Edited to make this work in the complex-analytic setting - see comment below.)
Let $s$ be a meromorphic section of $L$, described by the expressions
$$ U_1 \to \mathbb C, \ \ \ \ z \mapsto a(z)$$
$$ U_2 \to \mathbb C, \ \ \ \ z \mapsto b(z)$$
where $a(z) = g_{12}(z) b(z)$ on the overlap $U_1 \cap U_2$.
For convenience, we'll assume that $a(z)$ and $b(z)$ have no zeroes or poles on the contour $\{ |z| = 1 \}$. (If this isn't true, then we can just redefine our choice of $s$ by multiplying or dividing by linear functions, so this isn't a problem.) So the zeroes and poles of $s$ can be partitioned into two sets: those that lie in the region $\{ |z| < 1 \}$, and those that lie in the region $\{ |z| > 1 \}$.
In the region $\{ |z| < 1 \} \subset U_1$, the zeroes and poles of the  section $s$ coincide with the zeroes and poles of $a(z)$. By the argument principle, the number of zeros minus the number of poles of $a(z)$ within this region is given by the contour integral
$$ \frac{1}{2\pi i} \oint_{\{ |z| = 1\}}\frac{a'(z)}{a(z)} dz,$$
where the circular contour $\{ |z| = 1 \}$ is traversed counter-clockwise.
Similarly, in the region $\{ |z| > 1 \} \subset U_2$, $s$ is trivialised by $b(z)$, and the number of zeros minus the number of poles of $b(z)$ within this region is given by
$$ - \frac{1}{2\pi i} \oint_{\{ |z| = 1\}}\frac{b'(z)}{b(z)} dz.$$
[To derive this carefully, we would need to switch to the coordinate $w := 1 / z$, so that the point at infinity is covered by our coordinate choice, and apply the argument principle using $w$ as the coordinate. The minus sign comes from the fact that an anticlockwise traversal of the circle $\{ |w| = 1 \}$in $w$-space corresponds to a clockwise traversal of the circle $\{ |z| = 1 \}$ in $z$-space.]
The upshot is that the degree of $s$ is given by
$$ \frac{1}{2\pi i} \oint_{\{ |z| = 1\}}\frac{a'(z)}{a(z)} dz - \frac{1}{2\pi i} \oint_{\{ |z| = 1\}}\frac{b'(z)}{b(z)} dz.$$
Finally, since $a(z) = g_{12}(z)b(z)$ on the contour $\{ |z| = 1\}$, it's easy to show that
$$ \frac{a'(z)}{a(z)} - \frac{b'(z)}{b(z)} = \frac{g'_{12}(z)}{g_{12}(z)},$$
which completes the proof.
