<s>[INST] Why does $\int_0^{2\pi} (1+2\cos(x))/(5+4\cos(x))\,dx$ vanish? The standard substitution $y=\tan(x/2)$ shows that 
  $$ \int_0^{2\pi} \frac{1+2\cos(x)}{5+4\cos(x)}\,dx = 0. $$
What is the "real explanation" for this fact? My guess is that the "book proof" involves contour integration; is this correct? Is there an elegant "calculus proof" avoiding technical computations?
Thanks!   
 [/INST] Here is the desired elementary calculus argument. Note first that 
$$
\int_0^{2\pi} \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; 2\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx.
$$
Let $u = \arccos\left(-\dfrac{4+5\cos x}{5+4\cos x}\right)$.  Note that $u$ decreases continuously from $\pi$ to $0$ as $x$ goes from $0$ to $\pi$.  It is easy to check that
$$
1 + 2\cos x\;=\; -3\,\frac{1+2\cos u}{5+4\cos u}\qquad\text{and}\qquad du = \dfrac{-3\,dx}{5+4\cos x},
$$
so
$$
\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; \int_\pi^0 \frac{1+2\cos u}{5+4\cos u}\,du \;=\; -\int_0^\pi \frac{1+2\cos u}{5+4\cos u}\,du,
$$
and thus $\displaystyle\int_0^\pi \frac{1+2\cos x}{5+4\cos x}\,dx=0$.

Edit: By the way, the "best" way to evaluate this integral is indeed contour integration.  In particular,
$$
\int_0^{2\pi} \frac{1+2\cos x}{5+4\cos x}\,dx \;=\; \oint_C \frac{1+z+z^{-1}}{5+2z+2z^{-1}}\,\frac{dz}{iz} \;=\; \oint_C \frac{z^2+z+1}{iz(z+2)(2z+1)}\,dz,
$$
where $C$ is the unit circle, and the result follows immediately from the residue theorem (since the residue is $-i/2$ at $0$ and $i/2$ at $-1/2$).

Edit 2: The same argument shows in general that
$$
\int_0^\pi \frac{b+(a+c)\cos x}{c + b \cos x}\,dx \;=\; 0.
$$
whenever $a^2+b^2 = c^2$ and $a$, $b$, and $c$ are all positive.  The given integral is the case where $a=3$, $b=4$, and $c=5$.
</s>