Integrate a complex function Suppose $\gamma$ is the circle $|z|=1$ traversed counterclockwise.  Evaluate 
$$
\int_\gamma\frac{\cot(z)}{z^2}dz
$$
I was able to show $0$ is a pole of order $3$ for the integrand, and I think I have to use residues, but I am stuck.  Is this right so far?
 A: Yes, you are correct. The only pole inside the contour for the integrand is at $0$ with a multiplicity of $3$. You can make use of the Laurent series for $\cot(z)$ at $z=0$. $$\cot(z) = \dfrac1z - \dfrac{z}{3} + \mathcal{O}(z^3)$$
Hence, $$\dfrac{\cot(z)}{z^2} = \dfrac1{z^3} - \dfrac1{3z} + \mathcal{O}(z)$$
Hence, $$\oint_{\gamma} \dfrac{\cot(z)}{z^2} dz = 2 \pi i \times \text{Res} \left( \dfrac{\cot(z)}{z^2}\right)_{z=0} = - \dfrac{2 \pi i}{3}$$
EDIT
Below is a way to compute the residue easily. Note that if $n \in \mathbb{Z}^+$,
$$\lim_{z \to 0} z^n \cot(z) = \lim_{z \to 0} z^{n-1} \cdot \left(z \dfrac{\cos(z)}{\sin(z)} \right) = \lim_{z \to 0} z^{n-1} \cdot \lim_{z \to 0} \left(z \dfrac{\cos(z)}{\sin(z)} \right) = \lim_{z \to 0} z^{n-1} \cdot 1$$
Hence, $$\lim_{z \to 0} z^n \cot(z) = \begin{cases} 1 & \text{ if }n =1\\ 0 & \text{ if }n \in \mathbb{Z}^+\backslash\{1\}\end{cases}
$$
This means the Laurent series for $\cot(z)$ is of the form $\dfrac1z + a_0 + a_1 z + a_2 z^2 + a_3 z^3 + \cdots$.
Further, since $\cot(z)$ is an odd function, we have that $$\cot(z) = \dfrac1z + a_1 z + a_3 z^3 + a_5 z^5 + \cdots$$
Hence, the residue of $ \dfrac{\cot(z)}{z^2}$ is the coefficient $a_1$. From, the Laurent series, we can see that $a_1$ is nothing but $$a_1 = \lim_{z \to 0} \dfrac{z \cot(z) - 1}{z^2} = \lim_{z \to 0} \dfrac{z \cos(z) - \sin(z)}{z^2 \sin(z)} = \lim_{z \to 0} \dfrac{z (1-z^2/2+O(z^4)) - (z-z^3/6 + O(z^5))}{z^2 (z + O(z^3))}\\ =\lim_{z \to 0} \dfrac{-z^3/2 + O(z^5) +z^3/6 + O(z^5)}{z^3 + O(z^5)} =\lim_{z \to 0} \dfrac{-1/3 + O(z^2)}{1 + O(z^2)} = - \dfrac13$$
Hence, $$\text{Res} \left( \dfrac{\cot(z)}{z^2}\right)_{z=0} = -\dfrac13$$
A: Although I personally prefer to calculate residues via Laurent expansion wherever possible, there is a closed formula for the pole of the order $n$:
$$\operatorname{Res}_{z=z_0}f(z)=\frac{1}{(n-1)!}\lim_{z\to z_0}\left[f(z)(z-z_0)^n\right]^{(n-1)}$$
In this case:
$$\operatorname{Res}_{z=0}\frac{\cot{z}}{z^2}=\frac{1}{2!}\lim_{z\to 0}\left[\frac{\cot{z}}{z^2}z^3\right]^{(2)}=\frac{1}{2}\lim_{z\to 0}\left(z\cot{z}\right)^{(2)}$$
$$g(z)=z\cot z$$
$$\log g(z)=\log z +\log\cos z-\log\sin z$$
$$\frac{g'(z)}{g(z)}=\frac{1}{z}-\tan z-\cot z=\frac{1}{z}-\frac{1}{\sin z\cos z}$$
$$g'(z)=\cot z-\frac{z}{\sin^2 z}$$
$$g''(z)=-\frac{1}{\sin^2 z}-\frac{1}{\sin ^2z}+\frac{2z\cos z}{\sin^2z}=\frac{2(z\cos z-\sin z)}{\sin^3 z}$$
Using L'Hôpital's rule (of course i could have used series expansion, but this would be cheating):
$$\lim_{z\to 0} g''(z)=2\frac{\cos z-z\sin z-\cos z}{3\sin^2 z\cos z}=-\frac{2}{3}\lim_{z\to 0}\frac{1}{\frac{\sin z}{z}\cos z}=-\frac{2}{3}$$
Hence:
$$\operatorname{Res}_{z=0}\frac{\cot{z}}{z^3}=\frac{1}{2}\left(-\frac{2}{3}\right)=-\frac{1}{3}$$
