Computation real integral with residue theorem I need to compute $$I:=\int_{-\infty}^{\infty} \frac{\sin(ax)}{x(\pi^2-a^2x^2)}dx$$
($a>0$)
Probably there is a way to compute it with residue theorem.
My thoughts:

*

*The singularity at $x=0$ is removable


*

*$I=\displaystyle \DeclareMathOperator{Im}{Im} \Im \left( \int_{-\infty}^{\infty} \frac{e^{iax}}{x(\pi^2-a^2x^2)}dx \right)$ . I usually solve those integrals by using the residue theorem to integrate over the upper semicircle (then the integral over the arc goes to 0 as the radius goes to $\infty$ and we are left with I) but this doesn't work since we have non-removable singularities. I also thought about integrating over a circular sector whose border doesn't contain the singularities  (the integrand is an even function) but then the integral over the arc does not go to $0$ anymore and I don't get the expression for $I$ anyway.

 A: $$I=\int\frac{\sin (a x)}{x \left(\pi ^2-a^2 x^2\right)}\,dx=\int \frac{\sin (t)}{(t-\pi)t(t+\pi) }\,dt$$
$$\frac{1}{(t-\pi)t(t+\pi) }=\frac 1 {\pi^2}\Bigg[\frac{1}{2 (t-\pi )}+\frac{1}{2 (t+\pi )}-\frac{1}{t} \Bigg]$$
Consider
$$\int \frac {\sin(t)}{t+k}\,dt=\int\frac {\sin(u-k)}{u}\,du=\cos (k)\int\frac{ \sin (u)}{u}\,du-\sin (k)\int\frac{ \cos (u)}{u}\,du$$ So now, you just face sine and cosine integrals.
Back to $x$, you will have
$$I=\frac 1{2\pi^2}\Big[2 \text{Si}(a x)+\text{Si}(ax-\pi )+\text{Si}(a x+\pi ) \Big]$$
$$J=\int_{-p}^{+p}\frac{\sin (a x)}{x \left(\pi ^2-a^2 x^2\right)}\,dx=\frac 1{\pi^2}\Big[2 \text{Si}(a p)+\text{Si}(ap-\pi )+\text{Si}(a p+\pi ) \Big]\sim \frac 4{\pi^2}\text{Si}(a p)$$ Now, using the asymptotics
$$K=\int_{-\infty}^{+\infty}\frac{\sin (a x)}{x \left(\pi ^2-a^2 x^2\right)}\,dx=\frac{2 |a|}{\pi  a}$$
A: Assume without loss of generality that $a$ is positive. Using the change of variable $ax=\pi t$ we get rid of $a$
$$ I = \frac{1}{\pi^2} \int_{-\infty}^\infty \frac{\sin \pi t}{t(1-t)(1+t)}\,\mathrm dt $$ Apply the residue theorem (or Cauchy's theorem) to $\frac{e^{\pi i t}}{t(1-t)(1+t)}$ with the following contour

The large semi-circle has radius $\rho$ and the small ones have radius $\delta$. Take the imaginary part both sides, then use dominated convergence theorem as $\rho \to \infty$ and $\delta \to 0$.
EDIT
For example, the integral around $t=1$ is
$$ I_1(\delta) = \int_0^\pi \frac{\exp(\pi i(\overbrace{1+\delta e^{i\theta}}^{t}) )}{(\underbrace{1+\delta e^{i\theta}}_{t}) (\underbrace{-\delta e^{i\theta}}_{1-t}) (\underbrace{2+\delta e^{i\theta}}_{1+t})} \underbrace{(-i \delta e^{i\theta})\,\mathrm d\theta}_{\mathrm dt} =-i\int_0^\pi \frac{ \exp(\pi i \delta e^{i\theta})}{(1+\delta e^{i\theta})(2+\delta e^{i\theta})}\,\mathrm d\theta  $$ The integrand is continuous in $(\delta,\theta)$ for $\delta$  small enough, so we can use  DCT (or any  « continuity under $\int$ » theorem) to get
$$ I_1 :=\lim_{\delta\to 0} I_1(\delta) = -i \int_0^\pi \frac{1}{2}\,\mathrm d\theta = -\frac{\pi i}{2}  $$  Similarly $I_{-1} = -\frac{\pi i}{2}$ and $I_0=-\pi i$. Hence, as $\rho \to \infty$ and $\delta\to 0$
$$ \int_{-\infty}^\infty \frac{\sin \pi t}{t(1-t)(1+t)}\,\mathrm dt = -\operatorname{Im}(I_{-1} + I_0 + I_1) = 2\pi $$
A: Not a solution
Partial Fraction Decomposition of the denominator is straight forward as
$$ \frac{A}{x} + \frac{B}{\pi-ax}  + \frac{C}{\pi+ax} $$
Remains the Sine Integral type. You might consider their asymptotic behavior or win with Residue Calculus.
A: As the singularities are removable, I like to translate the contour so that it misses the singularities when we apply $\sin(x)=\frac1{2i}\left(e^{ix}-e^{-ix}\right)$.
$$\newcommand{\Res}{\operatorname*{Res}}
\begin{align}
&\int_{-\infty}^\infty\frac{\sin(ax)}{x(\pi^2-a^2x^2)}\,\mathrm{d}x\\
&=\int_{-i-\infty}^{-i+\infty}\frac{\sin(az)}{z(\pi^2-a^2z^2)}\,\mathrm{d}z\tag1\\
&=\lim_{R\to\infty}\frac1{2i}\left(\int_{U_R}\frac{e^{iaz}}{z(\pi^2-a^2z^2)}\,\mathrm{d}z-\int_{L_R}\frac{e^{-iaz}}{z(\pi^2-a^2z^2)}\,\mathrm{d}z\right)\tag2\\
&=\lim_{R\to\infty}\frac1{2i}\int_{U_R}\frac{e^{iaz}}{z(\pi^2-a^2z^2)}\,\mathrm{d}z\tag3\\
&=\frac{2\pi i}{2i}\left(\Res_{z=-\pi/a}+\Res_{z=0}+\Res_{z=\pi/a}\right)\left(\frac{e^{iaz}}{z(\pi^2-a^2z^2)}\right)\tag4\\
&=\frac{2\pi i}{2i}\left(\frac{-1}{\pi^2-3\pi^2}+\frac1{\pi^2}+\frac{-1}{\pi^2-3\pi^2}\right)\tag5\\
&=\frac2\pi\tag6
\end{align}
$$
Explanation:
$(1)$: Because the integrals over the vertical segments vanish as $R\to\infty$,
$\phantom{\text{(1):}}$ the difference is equal to the limit as $R\to\infty$ of the integral over
$\phantom{\text{(1):}}$ $[-R,R]\cup[R,R-i]\cup[R-i,-R-i]\cup[-R-i,-R]$
$\phantom{\text{(1):}}$ which is $0$ since the singularities of the integrand are removable
$(2)$: $U_R=[-R-i,R-i]\cup-i+Re^{+i[0,\pi]}$ (semi-circle in the upper half-plane)
$\phantom{\text{(2):}}$ $L_R=[-R-i,R-i]\cup-i+Re^{-i[0,\pi]}$ (semi-circle in the lower half-plane)
$\phantom{\text{(2):}}$ and the integrals over the semi-circles vanish as $R\to\infty$ since $a\gt0$
$(3)$: there are no singularities inside $L_R$
$(4)$: the integral is $2\pi i$ times the sum of the residues inside $U_R$
$(5)$: evaluate the residues
$(6)$: simplify
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
$\ds{\bbox[5px,#ffd]{}}$

\begin{align}
I &\equiv \bbox[5px,#ffd]{\left.\int_{-\infty}^{\infty} {\sin\pars{ax} \over x\pars{\pi^{2} - a^{2}x^{2}}}
\dd x\right\vert_{\, a\ \in\ \mathbb{R}}}
\\[5mm] & =
{1 \over a\verts{a}}\,\Im\int_{-\infty}^{\infty} {1 - \expo{\ic\verts{a}x} \over
x\pars{x - \pi/\verts{a}}\pars{x + \pi/\verts{a}}}\dd x
\\[5mm] & =
{1 \over a\verts{a}}\,\Im\bracks{2\pi\ic\,
{1 - \expo{\ic\verts{a}\pars{\pi/\verts{a}}} \over
\pars{\pi/\verts{a}}\pars{\pi/\verts{a} + \pi/\verts{a}}}}
\\[5mm] & =
{1 \over a\verts{a}}\,\Im\pars{2\pi\ic\,
{2 \over 2\pi^{2}/a^{2}}} =
\bbx{\color{#44f}{{2 \over \pi}\on{sgn}\pars{a}}} \\ &
\end{align}
