how to integrate $\frac{-1+e^{-i k x}}{x^2}$ How do I integrate the following?$$\int_{-\infty }^{\infty } \frac{-1+e^{-i k x}}{x^2} \, dx$$
I am not very familiar with complex analysis, but I did try to use contour integral to do this but I couldn't get any success with that. 
 A: If we interpret the integral as A Cauchy Principal Value, then we have
$$\int_{-\infty}^\infty\frac{-1+e^{-ikx}}{x^2}   \,dx=\int_{-\infty}^\infty \frac{-1+\cos(kx)}{x^2}\,dx$$
Using the trigonometric identity $\sin^2(kx/2)=\frac12(1-\cos(kx))$ and enforcing the substitution $kx/2\mapsto x$, we see that
$$ \int_{-\infty}^\infty \frac{-1+e^{ikx}}{x^2}\,dx=-k\int_{-\infty}^\infty \frac{\sin^2(x)}{x^2}\,dx$$
See THIS.  Can you finish now?
A: Another way to do it if you want to use contour integration is to use an indented semi circle in the upper half plane going around the singularity at $z=0$. For this contour, the function $f(z)=(e^{-ikz}-1)/z^2$ will integrate to 0 by Cauchy's theorem since it is holomorphic in the region enclosed by the indented semi circle. Now you simply split $\int_\gamma=\int_{C_R}+\int_{C_\epsilon}+\int_{-R}^{-\epsilon}+\int_{\epsilon}^{R}$ and you're left with justifying the exchange of limit and integrals when you want to let $\epsilon$ (radius of small semi circle) go to $0$ and R go to $\infty$ (radius of larger semi-circle).
Here are some examples : https://web.williams.edu/Mathematics/sjmiller/public_html/302/coursenotes/Trapper_MethodsContourIntegrals.pdf
There are also nice people explaining it in full detail on youtube, have fun !
