Compute $\int^{\pi/2}_0 \frac{dx}{(a^2\cos^2 x + b^2 \sin ^2 x)^2}$
For a solution that doesn't involve complex analysis: Try the substitution $t = \frac{a}{b} \tan u$. Then $du = \frac{ab}{a^2 + b^2 t^2} \,dt$ and your integral becomes $$\frac{1}{a^3 b^3} \int_0^{\pi/2} (b^2 \cos^2 u + a^2 \sin^2 u) \,du$$ which is more doable.
Say that $ a, b >0 .$ From the substitution $t \mapsto \dfrac{a}{b}t$ followed by $ t \mapsto \dfrac{1}{t}$ we get $$ I = \int_{0}^{\infty}\dfrac{1+t^{2}}{(a^{2}+b^{2}t^{2})^{2}}\, dt = \dfrac{1}{a^{3}b^{3}} \int_{0}^{\infty}\dfrac{b^2+a^2t^{2}}{(1+ t^{2})^{2}}\, dt $$ and $$ I = \dfrac{1}{a^{3}b^{3}} \int_{0}^{\infty}\dfrac{b^2t^2+a^2}{(1+ t^{2})^{2}}\, dt . $$ Consequently $$ 2I = \dfrac{a^2+b^2}{a^3b^3}\int_{0}^{\infty}\dfrac{1}{1+t^2}\, dt = \dfrac{\pi}{2}\dfrac{a^2+b^2}{a^3b^3} $$ and $$ I = \dfrac{\pi}{4}\dfrac{a^2+b^2}{a^3b^3}. $$
$f(z)=\frac{1+z^2}{(a^2+b^2 z^2)^2}$ is an even meromorphic function with double poles at $z=\pm\frac{a}{b}i$, that decays like $\frac{1}{|z|^2}$ as $|z|\to +\infty$. It follows that your integral equals
$$\pi i\cdot\text{Res}\left(f(z),z=\frac{a}{b}i\right)=\color{red}{\frac{\pi(a^2+b^2)}{4a^3b^3}} $$ due to the residue theorem and the ML lemma. For practicing headbanging, this is better.