Evaluating definite integrals via contours I'm having trouble understanding how to evaluate definite integrals via contours, more specifically how to transform these integrals such that I can use the Residue theorem. Take for example evaluating 
$$\int_0^{2\pi}d\theta\dfrac{1}{a + cos\theta}$$
where $a\in\mathbb{R}$ and $a > 1$. My textbook claims that I can evaluate this by choosing the transformation $z=e^{j\theta}$. Therefore, I can write $d\theta = \frac{1}{rj}e^{-j\theta}dz$ and I can also rewrite $\cos\theta$ in terms of $z$ using Euler's identity. 
This gives me a nice contour integral over the unit circle, but my question is how do I know that these two integrals are equivalent? Why was the unit circle chosen; e.g why wasn't the general case $z=re^{j\theta}$ considered?
I tried evaluating this by using $z=re^{j\theta}$ in hopes that the $r$'s would cancel out in the final result, but it does not (at least in the case when assuming $r$ is constant). It seems that $r=1$ was chosen with some reasoning. I'm failing to see why; my explanation right now is that interpreting $\theta$ as a polar angle implies that these $d\theta$ integrals are in fact integrating over $rd\theta$ and so we have $r=1$ in our case.
EDIT: Turns out I made an algebra mistake when using $z=re^{j\theta}$ and the $r$'s did in fact cancel... does this generalise?
 A: The unit circle is chosen because $\sin$ and $\cos$ are defined as the $x$ and $y$ coordinates of a point moving about the unit circle. 
Moreover, using 
$$ \sin \theta = \frac{z - \bar{z}}{2j}, \quad \cos \theta = \frac{z + \bar{z}}{2} $$
together with the fact that 
$$ \bar{z} = \frac{1}{z} $$
on the unit circle, you can turn the integral of any rational function of $\sin \theta$ and $\cos \theta$ on $[0, 2 \pi]$ into an integral of a rational function in $z$ over the unit circle. 
The reason for this equivalence is basically the definition of the integral over a complex-valued function over a given contour. Using the parametrization 
$$ z(\theta) = e^{j\theta}, \theta \in [0,2 \pi] \implies dz = j z d\theta, $$
you obtain
$$ \oint_{|z| = 1} \frac{dz}{jz} F \left( \frac{z - \frac{1}{z}}{2j}, \frac{z + \frac{1}{z}}{2} \right) = \int_0^{2 \pi} d\theta F(\sin \theta, \cos\theta).  $$
The integral on the left is often easily solved using the calculus of residues. Note that this gives you another reason to use the unit circle. If you don't make the substitution $\bar{z} = \frac{1}{z}$, then you can't use residues, as $\bar{z}$ is not analytic. 
