I have to calculate the integral
$$I = \int_{-\infty}^\infty\frac{x\cos(x)}{i+x^3} \,\mathrm{d}x.$$
My first thought was to use semicircular contour in the upper half-plane (calculated residue and multiplied by $2i\pi$); prove that integral over semicircle is zero when R->$\infty$; then take the limit
$$\lim_{R \to \infty}\int_{-R}^R\frac{ze^{iz}}{i+z^3} \,\mathrm{d}z = \int_{-\infty}^\infty\frac{ze^{iz}}{i+z^3} \,\mathrm{d}z;$$
and finally take the imaginary part of the integral. But then I figured I can't do that because I have i in the denominator.
I also tried writing cosx using e and then split the integral, calculated over two semicircles (positive direction in upper half-plane and negative in lower), added the two results and got something that looked kinda similar to the correct result.
What's the right way to solve this? Can I even use a semicircle or should I use a rectangle?
\begin{align} I &= \int_{-\infty}^\infty\frac{x\cos(x)(x^3-i)}{x^6+1} dx\\ &=\int_{-\infty}^\infty\frac{x^4\cos x}{x^6+1} dx-i\int_{-\infty}^\infty\frac{x\cos x}{x^6+1} dx\\ &=2\int_{0}^\infty\frac{x^4\cos x}{x^6+1} dx\\ \end{align} Now we can apply the residue theorem normally.