Calculating $\int_{-\infty}^{\infty}\frac{\cos x}{x^2+x+1}dx$ using the Residue Theorem I am suposed to evaluate $$\int_{-\infty}^{\infty}\frac{\cos x}{x^2+x+1}dx$$ using
$$f(z)=\frac{e^{iz}}{z^2+z+1}$$ My idea was to define a contour $$\gamma = [-R,R] \cup \alpha$$ where $$\alpha$$ is the upper semicircumference of radius $R$. But I am stuck here.

Some hints:
The polynomial $z^2+z+1$ has roots at $r_1=\frac{-1 + \sqrt{3}i}{2}$ and $r_2=\overline{r}_1$. If you are using the upper semicircle, then you need the residue at $r_1$. The idea is to take
$$
z\mapsto \frac{e^{iz}}{(z-r_1)(z-r_2)}
$$
and cancel out the $(z-r_2)$ term. This can be done if you expand $e^{iz}$ about $z=r_2$. In other words, write $e^{iz}=e^{ir_2}e^{i(z-r_2)}$. Then expand the power series and you end up with the residue of $r_1$.
