# let $f$ be any meromorphic function then $\operatorname{ord}_p(f)=0$

let $f$ be any meromorphic function at $p$ whose laurent series is $\sum_n c_n(z-z_0)^n$, define the $order$ of $f$ at $p$ $$\operatorname{ord}_p (f)= \min\{n:c_n\neq 0\}$$ let $f=\frac{p}{q}$ be a rational function, considered as meromorphic function on a riemann sphere, we may factor $p,q$ and write $$f(z)=c\prod_i (z - \lambda_i)^{e_i}$$ c is a nonzero constant, $\lambda_i$ are distinct complex number and $e_i$ are integers, Then $\operatorname{ord}_{z=\lambda_i}(f)=e^i$ but why $\operatorname{ord}_\infty = \deg(q) - \deg(p)=-\sum_i e_i$? and finally $\operatorname{ord}_x (f)=0$ unless $x=\infty$ or $x$ is one of $\lambda_i$? and why $\sum_{x\in X}\operatorname{ord}_x(f)=0$? Thank you for your help.

By definition, $\operatorname{ord}_\infty(f) = \operatorname{ord}_0(\hat f)$ where $\hat f(z) := f(\frac{1}{z})$. In particular, if $f(z) = a_n z^n + \ldots + a_1 z + a_0$ is a polynomial with $a_n \neq 0$ then $\hat f$ has a pole of order $n$ at $0$, hence $\operatorname{ord}_\infty(f) = \operatorname{ord}_0(\hat f) = -\deg f$. Since the order function satisfies $\operatorname{ord}(fg) = \operatorname{ord}(f) + \operatorname{ord}(g)$ it follows that $$\operatorname{ord}_\infty(p/q) = \deg q - \deg p$$ for polynomials $p$ and $q$.
If $f(z) = c \prod_i (z-\lambda_i)^{e_i}$ and $x$ is different from all $\lambda_i$ and $\infty$ then $$\operatorname{ord}_x(f) = \operatorname{ord}_x(c) + \sum_i e_i \, \operatorname{ord}_x(z-\lambda_i) = 0$$ since the functions $z \mapsto z-\lambda_i$ are holomorphic and don't vanish in $x$.
The relation $\sum_x \operatorname{ord}_x(f) = 0$ follows from $$\operatorname{ord}_\infty(f) = -\sum_i e_i = - \sum_i \operatorname{ord}_{\lambda_i}(f).$$