Proving $\int_{0}^\pi \frac{2\cos 2\theta + \cos 3\theta}{5+4\cos\theta} = \frac{\pi}{8}$ Given that $$\int_{|z|=1|}\frac{z^2}{2z+1} dz = \frac{i\pi}{4}$$,
show $$\int_{0}^\pi \frac{2\cos 2 \theta + \cos 3\theta}{5+4\cos\theta} = \frac{\pi}{8}$$.  
I saw the bounds of the latter integral and thought that I should try and parametrize using $z = e^{2i\theta}$ where $\theta \in [0,\pi]$.
This doesn't seem to simplify easily.
i saw this thread: Show that $\int_0^\pi\frac{2\cos(2\theta)+\cos(3\theta)}{5+4\cos(\theta)}d\theta=\frac{\pi}{8}$ 
and the top answer says:
$$\begin{align}
\int_0^\pi \frac{2\cos(2\theta)+\cos(3\theta)}{5+4\cos(\theta)}\,d\theta&=\frac12\text{Re}\left(\oint_{|z|=1}\frac{2z^2+z^3}{5+2(z+z^{-1})}\,\frac{1}{iz}\,dz\right)\\\\\end{align}$$
which I don't understand.   
How does multiplying a half to the integral with contour $|z|=1$ (parametrized by $z = e^{i\theta}, \theta\in [0,2\pi]$) give the LHS?  
I tried looking at it by taking the latter integral and using the substitution $u=\pi + \theta$, in hopes that the integrand simplifies to stay the same but it doesn't, so I can't see why the integral with bounds $0,\pi$ is half the integral that would have bounds $0,2\pi$ (since we would use the parametrization $z=e^{i\theta}$).

With $\theta\to-\theta$
$$
I=\int_0^{-\pi} \frac{2\cos(2\theta)+\cos(3\theta)}{5+4\cos(\theta)}\,(-)d\theta=\int_{-\pi}^0 \frac{2\cos(2\theta)+\cos(3\theta)}{5+4\cos(\theta)}\,d\theta
$$
\begin{align}
2I
&=\int_{-\pi}^\pi \frac{2\cos(2\theta)+\cos(3\theta)}{5+4\cos(\theta)}\, d\theta\\
&=\int_{|z|=1} \frac{{\bf Re\,}(2z^2+z^3)}{5+2(z+z^{-1})}\,\dfrac{1}{iz} dz,\\
&={\bf Re\,}\int_{|z|=1} \frac{2z^2+z^3}{5+2(z+z^{-1})}\,\dfrac{1}{iz} dz,\\
&={\bf Re\,}\dfrac{1}{i}\int_{|z|=1} \frac{z^2}{2z+1}\, dz,
\end{align}
Note that $\overline{z}=\dfrac{1}{z}$ so $\overline{dz}=d\overline{z}=-\dfrac{dz}{z^2}$ and $\dfrac{\overline{dz}}{\overline{iz}}=-\dfrac{dz}{-i\overline{z}z^2}=\dfrac{dz}{iz}$ and also ${\bf Re\,}(z+\overline{z})=z+\overline{z}$. The rest is simple.
