$$\begin{align} \text{Res}[\cot (\pi z), n] &= \lim_{z \to n} \ (z-n) \cot (\pi z) \\ &= \lim_{z \to n} \ (z-n) \frac{\cos (\pi z)}{\sin (\pi z)} \\ &= \lim_{z \to n} \frac{\cos \pi z - (z-n) \pi \sin (\pi z)}{\pi \cos (\pi z)} \ \ (\text{ L'Hospital's rule}) \\ &= \frac{\cos (\pi n)-0}{\pi \cos(\pi n)} \\&= \frac{1}{\pi} \end{align}$$
In general, if $f(z)$ and $g(z)$ are analytic at $z=z_{0}$, $f(z_{0}) \ne 0$, and $g(z)$ has a simple zero at $z=z_{0}$, then
$$ \text{Res}\Big[ \frac{f(z)}{g(z)}, z_{0} \Big] = \frac{f(z_{0})}{g'(z_{0})}.$$
$$\cot^2(z) = \frac{\cos^2(z)}{\sin^2(z)} \ \ \text{ so we need only worry about the zeros of } \sin^2(z)$$
These zeros occur when $z_k = k \pi$ for $k \in \mathbb{Z}$, as you've already identified.
Moreover, they are 2nd order zeros, as $(\sin^2(z))' = 2 \sin(z) \cos(z)$, which also has zeros at $z_k$, whereas $(2 \sin(z) \cos(z))' = 2 \cos^2(z) - 2\sin^2(z)$, which is nonzero at $z_k$.
Hence, $\cot^2(z)$ has $2^{nd}$ order poles when $z_k = k \pi, k \in \mathbb{Z}$. Therefore,
$$\text{Res}_{z = z_k} \cot^2(z) = \lim_{z \to z_k} \frac{d}{dz}\frac{\cos^2(z)(z - z_k)^2}{\sin^2(z)}$$
Calculate this derivative, then take the limit by applying L'Hopital's rule
In general, if $f(z)$ has an $n^{th}$ order pole at $z = z_k$, then
$$\text{Res}_{z = z_k} f(z) = \frac1{(n-1)!} \lim_{z \to z_k} \frac{d^{n-1}}{dz^{n-1}} \left[(z-z_k)^n\, f(z)\right]$$
Which can be seen directly from the Laurent expansion of $f$
Best Answer
Your answer is correct, and here is another way to try, in particular when taking derivatives or limits can be a little troublesome, and using the fact that we're only interested in low powers of $\;z\;$ in power or Laurent series since we want to find out something at $\;z=0\;$:
$$\frac{\cos z}{\sin z}=\frac{1-\frac{z^2}2+\ldots}{z-\frac{z^3}6+\ldots}=\frac{1-\frac{z^2}2+\ldots}{z\left(1-\frac{z^2}6+\ldots\right)}=\frac1z\left(1-\frac{z^2}2+\ldots\right)\left(1+\frac{z^2}6+\frac{z^4}{36}+\ldots\right)=$$
You can see the above two parentheses are power series and thus analytic, so in order to find out what the coefficient of $\;z^{-1}\;$ is we just do
$$=\frac1z\left(1-\frac{z^3}3+\ldots\right)=\frac1z+\ldots$$
and thus the residue is certainly $\;1\;$ .