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?