Calculation of residues Let be $a\in\mathbb C\setminus\mathbb Z$ a fixed complex number, and define the following function:
$$f(z)=\frac{a\pi\cot\pi z}{z(a-z)}$$
It has simple poles in $z\in\mathbb Z\setminus\{0\}$ and in $z=a$, and a double pole in $z=0$. my textbook says that it is straightforward that:
$\operatorname{Res}(f,n)=\frac{a}{n(a-n)}\;\;$   for  $n\in\mathbb Z\setminus\{0\}$
$\operatorname{Res}(f,a)=-\pi\cot\pi a$
$\operatorname{Res}(f,0)=\frac{1}{a}$
but I don't understand why these fact are true.

Note that the residue of $\pi \cot (\pi z) g(z)$ at $z=n, n= 0, \pm1, \pm 2, \cdots$ is
$$\operatorname*{Res}_{z=n}\,\pi \cot (\pi z) g(z) = \lim_{z \to n} (z-n)\pi \cot (\pi z) g(z)=
\lim_{z \to n} \pi \left(\frac{z-n}{\sin (\pi z)}\right) \cos (\pi z) g(z)=g(n)$$
It follows that
$$\operatorname*{Res}_{z=n}\,f(z)\,=\frac{a}{n(a-n)}$$
The reason that I used a general $g(x)$ function is because this interesting residue formula comes in handy for series evaluations later on.

$$\operatorname*{Res}_{z=a}\, \frac{a\pi\cot(\pi z)}{z(a-z)}=\lim_{z \to a} (z-a)\frac{a\pi\cot(\pi z)}{z(a-z)}=-\lim_{z \to a}\frac{a\pi\cot(\pi z)}{z}=-\pi \cot (\pi a)$$

$$\operatorname*{Res}_{z=0}\,f(z)=\lim_{z \to 0} (z-0)\frac{a\pi\cot(\pi z)}{z(a-z)}=\lim_{z \to 0} \frac{a\pi\cot(\pi z)}{a-z}=\frac{1}{a}$$
