Improper integral of $\sin^2(x)/x^2$ evaluated via residues

Note that $ \cos(2x)=1-2\sin(x)^2 $, this suggest to consider the integral

$$ \int_{C} \frac{ {\rm e}^{2 i z} - 1 }{ z^2} dz \,.$$


Since there are no singularities of $\frac{\sin^2(z)}{z^2}$ in the rectangle $[-R,R]\times[0,-i]$ and the function vanishes along the ends near $-R$ and $R$, $$ \begin{align} \int_{-\infty}^\infty\frac{\sin^2(x)}{x^2}\,\mathrm{d}x &=\int_{-\infty}^\infty\frac{2-e^{-2iz}-e^{2iz}}{4z^2}\,\mathrm{d}z\\ &=\int_{-\infty-i}^{\infty-i}\frac{2-e^{-2iz}-e^{2iz}}{4z^2}\,\mathrm{d}z\\ \end{align} $$ Next we can use two $D$-shaped contours $$ \gamma_+=[-R-i,R-i]\cup Re^{[0,\pi]i}-i $$ and $$ \gamma_-=[-R-i,R-i]\cup Re^{-[0,\pi]i}-i $$ Since the integral along the large semicircles vanishes and the singularity is only circled once counterclockwise by $\gamma_+$ and not by $\gamma_-$, we get $$ \begin{align} \int_{-\infty-i}^{\infty-i}\frac{2-e^{-2iz}-e^{2iz}}{4z^2}\,\mathrm{d}z &=\int_{\gamma_-}\frac{2-e^{-2iz}}{4z^2}\,\mathrm{d}z -\int_{\gamma_+}\frac{e^{2iz}}{4z^2}\,\mathrm{d}z\\ &=0-2\pi i\cdot\frac{i}{2}\\[9pt] &=\pi \end{align} $$ since the residue of $$ \frac{e^{2iz}}{4z^2}=\frac1{4z^2}+\color{#C00000}{\frac{2i\color{#000000}{z}}{4\color{#000000}{z^2}}}+\frac{-2z^2}{4z^2}+\dots $$ at $z=0$ is $\frac i2$.