<s>[INST] Trigonometric residue integral The trigonometric complex integral is
$$
\int_0^{2\pi} \frac 1{(2+\sin \theta)^2} d\theta.
$$
My answer is below, and it is correct because I verified this numerically on WolframAlpha: https://www.wolframalpha.com/input/?i=%5Cint_0%5E(2pi)+1%2F%7B(2%2B%5Csin+%5Ctheta)%5E2%7D+d%5Ctheta
 [/INST] I applied the substitution $z=e^{i\theta}$ and then used the residue theorem to obtain
\begin{align*}
\int_0^{2\pi} \frac 1{(2+\sin \theta)^2} d\theta &= \int_{|z|=1} \frac 1{(2+\frac 1{2i}(z-\frac 1z))^2} \frac{dz}{iz} \\
&= 4i\int_{|z|=1} \frac z{(z^2+4iz-1)^2} dz \\
&= 4i \cdot 2\pi i \operatorname{Res}_{z=(-2+\sqrt 3)i} \frac z{(z^2+4iz-1)^2} \\
&= -8\pi \frac d{dz}\left.\left((z-(-2+\sqrt 3)i)^2 \frac z{(z^2+4iz-1)^2} \right)\right\vert_{z=(-2+\sqrt 3)i} \\
&= -8\pi \frac d{dz}\left.\left(\frac z{(z-(-2-\sqrt 3)i)^2}\right)\right\vert_{z=(-2+\sqrt 3)i} \\
&= -8\pi\left.\left(\frac{-z^2-(2+\sqrt 3)^2}{(z+(2+\sqrt 3)i)^4}\right)\right\vert_{z=(-2+\sqrt 3)i} \\
&= \boxed{\frac{4\pi\sqrt 3}9}
\end{align*}
</s>