<s>[INST] Calculate residue in every pole of $\frac{z^2}{(z-2)^2(\cos{z}-1)^3}$ The problem is as simple as the title suggests. Of course, the formula for the residue of an order $n$ pole involving $n-1$ derivatives could be applied, but the computation will be extremely long, as there are poles of order $6$ in the function: 
$\frac{z^2}{(z-2)^2(\cos{z}-1)^3}$
So I was trying to follow the way of finding out the Laurent series, but I am not sure how to proceed (I will need to compute the inverse of the series of $(\cos{z}-1)^3$ and I am not sure at all that this is an easy task. 
Are there other approaches that I should explore? 
Thanks a lot!! 
 [/INST] Let
$$f(z) = \frac {z^2} {(z - 2)^2} =
 1 + \frac 4 {z - 2} + \frac 4 {(z - 2)^2}, \\
g(z) = \frac 1 {(\cos z - 1)^3}.$$
To find the expansion of $g$, take the product of the series of $1/g$ and of $g$ and equate the coefficients:
$$(a z^6 + b z^8 + c z^{10} + O(z^{12}))
 (A z^{-6} + B z^{-4} + C z^{-2} + O(1)) = \\
a A + (a B + b A) z^2 + (a C + b B + c A) z^4 + O(z^6) = \\
1 + O(z^6) \Rightarrow \\
A = \frac 1 a, B = - \frac b {a^2}, C = \frac {b^2 - a c} {a^3}.$$
The series coefficients of $g$ at other poles $z_k = 2 \pi k$ are the same:
$$g(z) = -\frac 8 {(z - z_k)^6} -\frac 2 {(z - z_k)^4} -
 \frac 4 {15 (z - z_k)^2} + O(1), \\
\operatorname{Res}_{z = z_k} f(z) g(z) =
-8[(z - z_k)^5]f(z) - 2[(z - z_k)^3]f(z) - \frac 4 {15} [(z - z_k)^1]f(z) = \\
\frac {8 (\pi k)^5 - 32 (\pi k)^4 + 63 (\pi k)^3 - 47 (\pi k)^2 + 8 \pi k + 45}
 {30 (\pi k - 1)^7}.$$
The remaining residue is
$$\operatorname{Res}_{z = 2} f(z) g(z) = \frac {(3 \cot 1 - 1) \csc^6 1} 2.$$
The residue at $z = \infty$ is not defined, because $z = \infty$ is not an isolated singularity.
The sum of all residues is zero. This can be seen by considering the sequence of integrals of $f(z) g(z)$ over the circles with radii $(2 k + 1) \pi$. The sequence tends to zero, therefore the partial sums of the residues also tend to zero.
</s>