<s>[INST] Evaluate $\int_0^{2\pi} \frac{d\theta}{(1-a\cos(\theta)+a^2)}$ Evaluate $\displaystyle \int_0^{2\pi} \frac{d\theta}{(1-a\cos(\theta)+a^2)}$
Super general. I get to a step: $\displaystyle \frac{2}{i}$ multiplied by Path integral $\displaystyle \frac{z}{[(2-a)z^2 + 2(a^2  z) + a]}.$
No idea if I'm on the right track. Maybe distribute the $i$? Wondering if I can get some help. 
 [/INST] We have
$$I(a) = \int_{0}^{2 \pi} \dfrac{dx}{1+a^2-a \cos(x)} = \dfrac1{1+a^2} \int_0^{2\pi} \dfrac{dx}{1 - \dfrac{a}{1+a^2} \cos(x)}$$
Note that we always have $b = \dfrac{a}{1+a^2} < 1$. Hence, we can write
$$\dfrac1{1 - b \cos(x)} = \sum_{k=0}^{\infty}b^k \cos^k(x)$$
Now we have
$$\int_0^{2\pi} \dfrac{dx}{1 - b \cos(x)} = \sum_{k=0}^{\infty} \int_0^{2 \pi} b^k \cos^k(x)dx = \sum_{k=0}^{\infty} b^{2k} \int_0^{2 \pi} \cos^{2k}(x)dx (\because\text{odd terms integrate to }0)$$
We now have from here that
$$\int_0^{2 \pi} \cos^{2k}(x)dx= \dbinom{2k}k \dfrac{2 \pi}{4^k}$$
This gives us
$$\int_0^{2\pi} \dfrac{dx}{1 - b \cos(x)} = 2 \pi \left(\sum_{k=0}^{\infty} \dbinom{2k}k \left(\dfrac{b^2}4\right)^k\right) = \dfrac{2 \pi}{\sqrt{1-b^2}}$$
where we made use of the fact that the Taylor series of $\dfrac1{\sqrt{1-x}}$ is
$$\dfrac1{\sqrt{1-x}} = \sum_{k=0}^{\infty} \dbinom{2k}k \left(\dfrac{x}4\right)^k$$
Hence, we now have
$$I(a) = \dfrac1{1+a^2} \dfrac{2 \pi}{\sqrt{1-\left(\dfrac{a}{1+a^2}\right)^2}} = \dfrac{2 \pi}{\sqrt{1+a^2+a^4}}$$
</s>