<s>[INST] How does $\int_{z=-R+0i}^{R+0i} \frac{e^{2iz}-1-2iz}{z^2}\ dx$ become $\int_{-R}^R \frac{\sin^2x}{x^2}\ dx$? While trying to compute $\int_0^\infty \frac{\sin^2 x}{x^2}\ dx$, the author of this book suggests computing $\int_{C_R} \frac{e^{2iz}-1-2iz}{z^2}\ dz$ on a semi-circular contour in the upper half-plane.
The singularity at $z=0$ is removable, so the function is entire, so the integral becomes zero. He then makes a huge jump and says, "Thus, $-2\int_{-R}^R \frac{\sin^2 x}{x^2}\ dx -2i\int_{\Gamma_R} \frac{dz}{z} + \int_{\Gamma_R} \frac{e^{2i z}-1}{z^2}\ dz = 0$."
Here, $\Gamma_R$ denote the "arc" part of the semi-circular contour.
I get where he gets the second terms from. I don't get where he gets the first.
How do we go from 
$$\int_{-R}^R \frac{e^{2ix}-1-2ix}{x^2}\ dx$$
to
$$\int_{-R}^R \frac{\sin^2 x}{x^2}\ dx?$$
 [/INST] $$
e^{2iz}-1-2iz=1+2iz+\frac {(2iz)^2}2+\frac{(2iz)^3}6+\ldots\frac {(2iz)^n}{n!}+\ldots-1-2iz=\\
=\frac{(2iz)^2}2+\frac{(2iz)^3}{3!}+\ldots+\frac{(2iz)^{n+2}}{(n+2)!}+\ldots
$$
If you integrate it over $(-R, R)$, obviously all odd powers will drop out since their antiderivatives will be even. So let's consider even powers only
$$
e^{2iz}-1-2iz \stackrel{\int}{\equiv} \frac {(2ix)^2}{2!} + \frac {(2ix)^4}{4!} + \frac {(2ix)^6}{6!} + \ldots + \frac {(2ix)^{2k+2}}{(2k+2)!} + \ldots = \\
= -\frac {(2x)^2}{2!} + \frac {(2x)^4}{4!} - \frac {(2x)^6}{6!} + \ldots + (-1)^{k+1} \frac {(2x)^{2k+2}}{(2k+2)!} + \ldots =  \\
= 1 -\frac {(2x)^2}{2!} + \frac {(2x)^4}{4!} - \frac {(2x)^6}{6!} + \ldots + (-1)^{k+1} \frac {(2x)^{2k+2}}{(2k+2)!} + \ldots - 1 = \\
= \cos 2x-1 = -2\sin^2x
$$
</s>