Show that $ \sum_{z\in\mathbb{P}^{1}\left(\mathbb{C}\right)}\text{ord}_{z}\left(f\right)=0$ $ \mathbb{P}^{1}\left(\mathbb{C}\right) :=\mathbb{C}\cup{\infty} $
(There are  some different definitions, the one that I know is the stereographic projection and defining the image of the north pole under the projection as $\infty $ in $ \mathbb{C} $.
Define also $ \text{ord}_{z=a}\left(f\right) $ as the following:

*

*if $ f $ has a zero of multiplicity $m\geq1 $ at $ a $, then $ \text{ord}_{z=a}\left(f\right)= m $.


*if $ a $ is a pole of multiplicity $m\geq 1 $ for $ f $, then $ \text{ord}_{z=a}\left(f\right) = -m $


*if $ f $ defined well\has a removable singularity at $ a $ and $f(a) \neq 0 $ then $ \text{ord}_{z=a}\left(f\right) =0 $.
Prove that the following sum has finitely many nonzero terms and that $ \sum_{z\in\mathbb{P}^{1}\left(\mathbb{C}\right)}\text{ord}_{z}\left(f\right)=0 $
Where we define $ \text{ord}_{z=\infty}\left(f\right)=\text{ord}_{\omega=0}\left(g\right) $
Where $ g $ is the nonzero meromorphic function defined by $ g\left(\omega\right):=f\left(\frac{1}{\omega}\right) $.
Im have absolutely no intuition for the proof, I cant even understand why it is correct. For example what about the function $ \frac{1}{z}+\frac{1}{z-1} $ ?
It has a pole of order $ 1 $ in $0 $ and in $ 1 $ so that together it summed to $-2 $, and the order at $\infty $ is the order of $ z+\frac{z}{1-z} $ at $0 $, which is $1$. So it seems like the sum is not $0 $.
Any help would be appreciated.
 A: The meromorphic functions $f:\Bbb P^1(\Bbb C) \to \Bbb P^1(\Bbb C)$ are exactly the rational functions, see for example

*

*Suppose that $f$ is an analytic function from the Riemann sphere to the Riemann sphere, must f be a rational function?
In order for $\sum_{z \in\Bbb P^1(\Bbb C)} \operatorname{ord}_z(f)$ to make sense we must assume that $f$ is not identically zero and not identically $\infty$.
So we have $f(z) = p(z)/q(z)$ where $p, q$ are polynomials, both not the zero polynomials. Let $m = \deg(p)$ and $n = \deg(q)$ be the degrees of the polynomials.
If $m = n$ then $f$ has $m$ zeros and $m$ poles, counted with multiplicity, and $\lim_{z \to \infty} f(z) = a \ne 0, \infty$. In this case,
$$
\sum_{z \in\Bbb P^1(\Bbb C)} \operatorname{ord}_z(f) = m - m = 0 \, .
$$
If $m > n$ then $f$ has $m$ zeros and $n$ poles, and $f(1/z)$ has a pole of order $m-n$ at zero. In this case
$$
\sum_{z \in\Bbb P^1(\Bbb C)} \operatorname{ord}_z(f) = m - n - (m-n) = 0 \, .
$$
The case $m < n$ works similarly.
Example:
$$
 f(z) = \frac{1}{z} + \frac{1}{z-1} = \frac{2z-1}{z(z-1)}
$$
has two simple poles and one simple zero in $\Bbb C$. Also
$$
 f\left( \frac 1 z\right) = \frac{z(z-2)}{z-1}
$$
has a simple zero at $z=0$, so that $\operatorname{ord}_\infty(f) = 1$.

Remark: The same is true for meromorphic functions on arbitrary compact Riemann surfaces, see for example

*

*Is the sum of the orders of the zeros and poles of a meromorphic function 0?
