I wish to calculate the value of \begin{equation} \text{Res}\big((z+\pi/4)^2\tan(z);z=\pi/2\big)=\frac{1}{2\pi i}\int_C (z+\pi/4)^2\tan(z)\text{d}z, \end{equation} where $C$ is any counter-clockwise simple closed contour enclosing only $\pi/2$ from the poles of $\text{tan}$.
I've noticed that if the power of $z+\pi/4$ is $1$ instead of $2$ then one can integrate by parts along some, e.g., square contour $C$, and evaluate and sum the corresponding "edge" line integrals. But I imagine this trick fails here because there is no explicit formula for the anti-derivative of $\log(\cos)$ (that I know of!).
Might there be any other trick to achieve this? How difficult ought it be to calculate, e.g., the Laurent series of the integrand? Any ideas are most welcome!
$$R=\operatorname{Res}\left((z+\pi/4)^2 \tan(z); z=\pi/2\right) = -\operatorname{Res}\left((z+3\pi/4)^2 \cot(z); z=0\right)$$ and since in a neighbourhood of the origin: $$ \cot z = \frac{1}{z}-\frac{z}{3}-\frac{z^3}{45}+o(z^4),$$ $$ (z+3\pi/4)^2 = \frac{9\pi^2}{16}+\frac{3\pi}{2}z + z^2 $$ we just have: $$ R = \color{red}{-\frac{9\pi^2}{16}}.$$