This is an old revision of the document!
We talked about two integrals, one is $$ \int_{\theta=0}^{2\pi} \frac{1}{1 + \epsilon \cos(\theta)} d\theta, 0 < \epsilon \ll 1 $$ the other is $$ \int_{x=0}^\infty \frac{1}{1+x^n} dx $$
Suppose we have a ration function involving $\sin(\theta)$ and $\cos(\theta)$, $R(\sin \theta, \cos \theta)$, and we consider integral of the form $$ \int_{\theta=0}^{2\pi} R(\sin \theta, \cos \theta) d \theta$$ Then, we can replaced $e^{i\theta} = z$, let $z$ run on the unit circle.
Then we will get a rational function of $z$ as integrand, and the contour is the unit circle.
In our example, we get $$ I = \oint_{|z|=1} \frac{1}{1 + \epsilon (z+1/z)/2} dz/(iz) = (2/i) \oint_{|z|=1} \frac{1}{2z + \epsilon(z^2+1)} dz $$ We found the integrand function has two poles at $$ z_\pm = \frac{-2 \pm \sqrt{4 - 4\epsilon^2}}{2\epsilon} = \frac{-1 \pm \sqrt{1 - \epsilon^2}}{\epsilon} $$ We can check $z_+$ is within the unit circle, $z_-$ is outside it. Hence to apply residue theorem, we get $$ I = (2\pi i) (2/i) Res_{z=z_+} \frac{1}{2z + \epsilon(z^2+1)} = \frac{4\pi}{2 + 2 \epsilon z_+} = \frac{2\pi}{\sqrt{1-\epsilon^2}}$$