For $z \in \mathbb{C}$, let $f(z)$ be defined as follows:
\begin{equation}
f(z)=2\int\limits_{0}^{+\infty} \frac{x}{\sin(zx)}\,\mathrm{d}x
\end{equation}
Using the complex exponential definition of $\sin(zx)$:
\begin{equation}
f(z)=4i\int\limits_{0}^{+\infty} \frac{x}{e^{izx}-e^{-izx}}\,\mathrm{d}x
\end{equation}
\begin{equation}
f(z)=4i\int\limits_{0}^{+\infty} \frac{xe^{-izx}}{1-e^{-2izx}}\,\mathrm{d}x
\end{equation}
Using the geometric series for $e^{-2izx}$, you get the following:
\begin{equation}
f(z)=4i\int\limits_{0}^{+\infty} xe^{-izx}\sum_{k=0}^{+\infty}e^{-2izxk}\,\mathrm{d}x
\end{equation}
\begin{equation}
f(z)=4i\sum_{k=0}^{+\infty}\int\limits_{0}^{+\infty} xe^{-izx(1+2k)}\,\mathrm{d}x
\end{equation}
With the substitution $s=izx(1+2k)$, you get that:
\begin{equation}
f(z)=\frac{4i}{z^{2}}\sum_{k=0}^{+\infty}\frac{1}{(1+2k)^{2}}\int\limits_{0}^{+\infty} se^{-s}\,\mathrm{d}s
\end{equation}
The integral is just $\Gamma(2)$, thus:
\begin{equation}
f(z)=\frac{4i}{z^{2}}\sum_{k=0}^{+\infty}\frac{1}{(1+2k)^{2}}
\end{equation}
The last sum is known to converge to $\pi^{2}/8$, so you can conclude that:
\begin{equation}
\int\limits_{-\infty}^{+\infty} \frac{x}{\sin(zx)}\,\mathrm{d}x= \frac{i\pi^{2}}{2z^{2}}
\end{equation}
From the result, one can indeed see that $f(i)=-i\pi^{2}/2$.