Solve integrals using residue theorem? $$\int_{0}^{\pi}\frac{d\theta }{2+\cos\theta}$$
$$\int_{0}^{\infty}\frac{x }{(1+x)^6} dx$$
My problem is that I don't know how to start solving these integrals, or how to convert them into usual types that can be solved.

Hint for the First one First compute 
$$
I=\int_0^{2\pi} \frac{d\theta}{2 + \cos\theta}=\int_0^{2\pi}R(\cos(\theta), \sin(\theta)) d\theta
$$
Where $R$ is the rational function given by $$R(x,y)=\frac{1}{2+x}$$
How to do this using the residue theorem? Put $z=e^{it}=\cos(t)+i\sin(t)$, thus 
$$
\cos(t)=Re(z)=\frac{z+z^{-1}}{2}, \ \\ \sin(t)=Im(z)=\frac{z-z^{-1}}{2i}, \\ dz=ie^{it} dt=iz \ dt \Longrightarrow dt=\frac{1}{iz}dz
$$
Then $I$ can be seen as a contour integral, solve it by using residues 
$$
I=\int_0^{2\pi}R(\cos(t), \sin(t)) dt= \int_{|z|=1} R\left(\frac{z+1/z}{2}, \frac{z-1/z}{2i} \right)\frac{1}{iz}dz
$$
Hence in your case the integral you will compute is
$$
I= \int_{|z|=1} \left(\frac{1}{2+\frac{z+1/z}{2}} \right)\frac{1}{iz}dz = \frac{2}{i} \int_{|z|=1} \frac{dz}{z^2+4z+1}
$$
which can be easily obtain by the residue theorem!
Finally: Note that 
$$
\int_0^{\pi} \frac{d\theta}{2 + \cos\theta}=\frac{I}{2}
$$
and hence your result follows by computing the next integral 
$$
\int_0^{\pi} \frac{d\theta}{2 + \cos\theta} = \frac{1}{i} \int_{|z|=1} \frac{dz}{z^2+4z+1} 
$$ 
Spoiler Solution

 Since $z^2+4z+1=(z-(\sqrt{3}-2))(z-(-\sqrt{3}-2))$ and $z_0=\sqrt{3}-2$ is the only root inside the contour $|z|=1$, then by the residue theorem we have $\displaystyle \int_{|z|=1} \frac{dz}{z^2+4z+1} = 2\pi i \left( \frac{1}{2\sqrt{3}}\right)=i \frac{\pi}{\sqrt{3}}$. Hence we get that the final result is $\displaystyle \int_0^{\pi} \frac{d\theta}{2 + \cos\theta}  =\frac{1}{i} \times i \frac{\pi}{\sqrt{3}}=\frac{\pi}{\sqrt{3}}$

