Calculating residue of pole of order $2$ Is there a good way to compute the residue of $f(z)=\dfrac{1+z}{1-\sin z}$ at $z=\pi/2$, which is a pole of order $2$?
Using the residue calculation formula yields
$$\text{Res}_{z=\pi/2}f(z)=\lim_{z\rightarrow\pi/2}\dfrac{d}{dz}\left(\left(z-\dfrac\pi2\right)^2f(z)\right)$$
The derivative is quite ugly, and calculating the limit requires L'Hospital probably twice (or more). The calculation is just too much. Is there a better way?
 A: My other answer (and Antonios above) requires knowledge of finding poles through Laurent series, which I assumed you have done (I hope!), but it is possible you have not. Instead, you can use that when $f(z) = \frac{p(z)}{q(z)}$ has a pole at $z=z_0$ where $p(z)$ and $q(z)$ are analytic in any neighborhood of $z_0$, you have $Res(f;z=z_0) = \frac{p(z_0)}{q'(z_0)}$. If, as in this case, $q'(z_0)=0$, you have to change this formula. It was derived from the Taylor series of $p(z)$ and $q(z)$ about $z=z_0$. So, we can take the next order term, namely $Res(f,z=z_0) = \frac{p'(z_0)}{q''{z_0}/2!}$. Here you have that case and can apply this formula nicely, but it is important to see where it comes from which is the residue from the Laurent series as described before.
A: I love using Taylor series expansions, as I find they're often the easiest way by hand. Let $z=u+\pi/2$, then
$$f(z)=\frac{1+u+\frac{\pi}{2}}{1-\sin(u+\frac{\pi}{2})}=\frac{1+\frac{\pi}{2}+u}{1-\cos u}=\frac{1+\frac{\pi}{2}+u}{1-(1-u^2/2!+u^4/4!-\cdots)}.$$
Simplifying the denominator and extracting a factor of $u^2$,
$$\frac{1}{u^2}\frac{1+\frac{\pi}{2}+u}{1/2!-u^2/4!+u^4/6!-\cdots}=\frac{2}{u^2}\frac{1+\frac{\pi}{2}+u}{1-2u^2/4!+2u^4/6!-\cdots}.$$
Now using $\frac{1}{1-z}=1+O(z)$, we get
$$\frac{2}{u^2}(1+\frac{\pi}{2}+u)(1+O(u^2))=\frac{2}{u^2}(1+\frac{\pi}{2})+\frac{2}{u}+O(1),$$
or in other words
$$f(z)=\frac{2(1+\frac{\pi}{2})}{(z-\frac{\pi}{2})^2}+\frac{2}{z-\frac{\pi}{2}}+O(1),$$
so clearly $\text{Res}(f,\frac{\pi}{2})=2$.
A: Consider the residue of $f(z)/g(z)$ at the double pole $z=a$.  Because $a$ is a double zero of $g(z)$, write
$$g(z) = (z-a)^2 p(z)$$
where $p(a) \ne 0$ and is analytic, etc. etc.
Then
$$\operatorname*{Res}_{z=a} \frac{f(z)}{g(z)} = \left [\frac{d}{dz} \frac{f(z)}{p(z)} \right ]_{z=a}$$
Now,
$$\frac{d}{dz} \frac{f(z)}{p(z)} = \frac{f'(z) p(z)-f(z) p'(z)}{p(z)^2}$$
Also, note that
$$g(z) = \frac12 g''(a) (z-a)^2 + \frac16 g'''(a) (z-a)^3+\cdots = p(a) (z-a)^2 + p'(a) (z-a)^3+\cdots$$
Therefore
$$p(a) = \frac12 g''(a)$$
and
$$p'(a) = \frac16 g'''(a)$$
Thus
$$\operatorname*{Res}_{z=a} \frac{f(z)}{g(z)} =  \frac{6 f'(a) g''(a) - 2 f(a) g'''(a)}{3 [g''(a)]^2}$$
In your case, $f(z)=1+z$ and $g(z)=1-\sin{z}$.  The residue at $z=\pi/2$ is then $2$.
