Integral $\int_0^\infty \frac{\sin x}{\cosh ax+\cos x}\frac{x}{x^2-\pi^2}dx=\tan^{-1}\left(\frac{1}{a}\right)-\frac{1}{a}$

Please help me prove the following identity: $$\int_0^\infty \frac{\sin x}{\cosh ax+\cos x}\frac{x}{x^2-\pi^2}dx=\tan^{-1}\left(\frac{1}{a}\right)-\frac{1}{a}\quad a>0$$
This integral is from Gradshteyn and Ryzhik’s tables.

Solutions Collecting From Web of "Integral $\int_0^\infty \frac{\sin x}{\cosh ax+\cos x}\frac{x}{x^2-\pi^2}dx=\tan^{-1}\left(\frac{1}{a}\right)-\frac{1}{a}$"

Lemma. For $a>0$ and $x\in\Bbb{R}$,
$$
\sum_{n=1}^\infty2(-1)^{n-1}\sin(nx)e^{-anx}=\frac{\sin x}{\cosh(ax)+\cos x}\tag {1}
$$

Proof. Indeed,
$$\eqalign{
\sum_{n=1}^\infty2(-1)^{n-1}\sin(nx)e^{-anx}&=
-2\Im\left(\sum_{n=1}^\infty(-1)^n e^{(i-a)nx}\right)\cr
&=2\Im\left(\frac{e^{(i-a)x}}{1+e^{(i-a)x}}\right)\cr
&=\frac{\sin x}{\cosh(ax)+\cos x}.\qquad\square
}$$

Now, let
$$I(a)=\int_0^\infty\frac{\sin x}{\cosh(ax)+\cos x}\cdot\frac{x}{x^2-\pi^2}\,dx.$$
Then
$$\eqalign{
I(a)&=\sum_{n=1}^\infty2(-1)^{n-1}\int_0^\infty\frac{x}{x^2-\pi^2}\sin(nx)e^{-anx}dx\cr
&=\sum_{n=1}^\infty2(-1)^{n-1}\int_0^\infty\frac{t}{t^2-n^2\pi^2}\sin t e^{-at}dt\cr
&=\int_0^\infty\left(\sum_{n=1}^\infty\frac{2t(-1)^{n-1}}{t^2-n^2\pi^2}\right)\sin t e^{-at}dt\cr
&\buildrel{(*)}\over{=}\int_0^\infty\left(\frac{1}{t}-\frac{1}{\sin t}\right)\sin t e^{-at}dt\cr
&=\int_0^\infty\frac{\sin t}{t} e^{-at}dt-\int_0^\infty e^{-at}dt\cr
&=\arctan\frac{1}{a}-\frac{1}{a}
}
$$
as desired.

For more information on the partial fraction decomposition $(*)$ of the $\csc$ function, one may consult Alfors’ Book Chapter 5. pp.185–188. $\qquad\square$