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.

For simple poles, it's easy:
$Res(f,n) = \lim_{z\to n} (z-n)f(z) = \frac{a}{n(a-n)}$ for $n \in \mathbb Z$
Because $\lim_{z\to n} (z-n) \cot(\pi z) = \frac{1}{\pi}$.
We also have:
$Res(f,a) = \lim_{z\to a} (z-a)f(z) = -\pi \cot(\pi a)$
For the double pole in $b$, you can use the formula: 
$Res(f,b) = \lim_{z\to b} \frac{d}{dz} \left( (z-b)^2f(z) \right)$
$\frac{d}{dz}\left( (z-b)^2f(z) \right) = \frac{-\pi\,a\,z\,{\csc\left( z\right) }^{2}}{a-z}+\frac{\pi\,a\,z\,\cot\left( z\right) }{{\left( a-z\right) }^{2}}+\frac{\pi\,a\,\cot\left( z\right) }{a-z}$
So the limit seems to be $\frac{\pi}{a}$ and not $\frac1a$
