Why the number of points where $f$ ramifies is finite? I know roughly that there is a theorem in complex analysis saying that if $f$ has degree $e_x>1$ at point $x$, which is $f(z)=(x-z)^{e_x}g(z)$, then $f^{-1}(y)$ has $e_x$ different preimages in a neighborhood of $y$.
In a complex Riemann surface, we have the same result considering $f$ in the local coordinates.
We call that $f$ ramifies at point $x$ if $e_x>1$.
I was told that the number of points where $e_x>1$ is finite.
Can anyone tell me why? Is this result valid only in compact Riemann surface or generally?

update:
I realized that $f$ has digree $e_x$ at $x$ sould be $f(z)-f(x)=(z-x)^{e_x}g(z)$ rather than what I originally posted.
Sorry for trouble..
 A: Suppose there are infinitely many $x$ for which $e_x>1$.  Any infinite subset of a compact set has an accumulation point in the set, so $f(z) = 0$ on a sequence which converges in your domain and must be zero by the identity theorem.
If $f$ is nonzero, it must have only finitely-many such zeros.
Now, if the domain isn't compact, then $f$ may indeed have infinitely many such $x$, for example if $f(z)=\sin^2 z$.
A: If $f:X \to Y$, a non-constant holomorphic map of Riemann surfaces, has ramification degree $e$ in a n.h. of a point $x$, then we may choose local coords. in the source and target so that $x$ and $f(x)$ both lie at the origin, and $f$ is given by $z \mapsto z^e$.  Note that every point other than zero in this n.h. of $x$ is not a ram. point.  So every point $x$, whether or not it is a ramification point (i.e. whether or not $e > 1$) has a n.h. $U$ so that $U\setminus \{x\}$ contains no ramification points. 
Conclusion: the set of ramification points is closed and discrete.
In particular, if $X$ is compact, then the set of ramification points is compact and discrete, thus finite.  If $X$ is not compact, then the set of ramification points need not be finite (as the examples already given in the comments show).
