# How can I use residues to solve this real integral?

I came across the following integral $$\int_0^{2\pi}\arctan\left[\frac{\sin\left(\theta\right)}{\cos\left(\theta\right)+3}\right]\,d\theta$$ in my Complex Analysis book regarding the evaluation of integrals of the form $$\int_0^{2\pi}F(\sin(\theta),\cos(\theta))\,d\theta.$$

I noticed that, using the subsitution $u=\theta-\pi$, we can express the integral as $$\int_{-\pi}^{\pi}\arctan\left[\frac{-\sin\left(u\right)}{3-\cos\left(u\right)}\right]\,du$$ which is an odd function being integrated in a symmetrical interval about zero, so the value of the integral is $0$.

Now, even though this solution is much quicker, I was interested in the use of residues and contour integration. Using the subsitution $z=e^{i\theta}$, I was able to write it as $$\int_Ciz^{-1}\arctan\left[\frac{i(z^2-1)}{z^2+6z+1}\right]dz$$ where $C$ is the circle of radius $1$ centered at the origin.

So if we set $$f(z)=\frac{i\arctan\left[\frac{i(z^2-1)}{z^2+6z+1}\right]}{z}$$ one can see that $z=0$ is the only possible singularity inside $C$. However, both numerator and denominator are not defined at such point. So how would I go about solving this integral with the aid of residues?

In fact, with $$\log$$ denoting the principal branch of the logarithm we have \eqalign{I&=\Im \int_{0}^{2\pi}\log(3+e^{i\theta}) d\theta\cr &=\Im \int_{C^+(3,1)}\log(z)\frac{dz}{iz}\cr &=2\pi \Im\left(\frac{1}{2\pi i}\int_{C^+(3,1)}\frac{\log( z)}{z}dz\right)\cr &=2\pi \Im ({\rm Ind}(0,C^+(3,1)) \log3)=0}