Consider the following improper integral:
\begin{equation} \int_0^\infty \frac{\cos{2x}-1}{x^2}\;dx \end{equation}
I would like to evaluate it via contour integration (the path is a semicircle in the upper plane), but i have some problems: first, the only singularity would be $z=0$, but it is only an apparent singularity so the residue is $0$. There are no other singularity of interest, so the integral should be zero... But it can't be zero, so?