Evaluating $\int_{0}^{\infty} \frac{x}{\cosh (a x)} d x$ for a positive constant $a$ We first simplify the integral by a substitution and then convert the integrand into a power series as below:
$$
\begin{aligned}
\int_{0}^{\infty} \frac{x}{\cosh (ax)} d x & \stackrel{ax\mapsto x}{=} \frac{1}{a^{2}} \int_{0}^{\infty} \frac{x}{\cosh x} d x \\
&=\frac{2}{a^{2}} \int_{0}^{\infty} \frac{x e^{-x}}{1+e^{-2 x}} d x \\
&=\frac{2}{a^{2}} \sum_{k=0}^{\infty}(-1)^{k} \int_{0}^{\infty} x e^{-(2 k+1) x} d x
\end{aligned}
$$
Using integration by parts, we have
$$
\int_{0}^{\infty} x e^{-(2 k+1) x} d x=\frac{1}{(2 k+1)^{2}}
$$
Hence we can now conclude that
$$
\begin{aligned}
\int_{0}^{\infty} \frac{x}{\cosh (a x)} d x &=\frac{2}{a^{2}} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{(2 k+1)^{2}} =\frac{2G}{a^{2}}
\end{aligned}
$$
where $G$ is the Catalan’s constant.
Are there methods other than power series?
 A: If you enjoy polylogarithms, let $x=it$
$$I=\int x \,\text{sech}(x)\,dx=-\int t \sec (t)\,dt$$ which, I think, you already solved.
Back to $x$
$$I=-i \left(\text{Li}_2\left(-i e^{-x}\right)-\text{Li}_2\left(i e^{-x}\right)+x
   \left(\log \left(1-i e^{-x}\right)-\log \left(1+i
   e^{-x}\right)\right)\right)$$
A: As suggested by TheSimpliFire, I transform the integral, by letting
$\tan \theta=e^{-x}$, into
$$
\begin{aligned}
\int_{0}^{\infty} \frac{x}{\cosh x} d x &=2 \int_{0}^{\infty} \frac{x}{e^{x}+e^{-x}} d \alpha \\
&=-2 \int_{0}^{\frac{\pi}{4}} \ln (\tan \theta) d \theta 
\end{aligned}
$$
By my post,
$\int_{0}^{\frac{\pi}{4}} \ln (\tan \theta) d \theta=-G$, therefore we can conclude that $$\boxed{\int_{0}^{\infty} \frac{x}{\cosh (a x)} d x =\frac{2G}{a^2}   }$$
A: $\newcommand{\d}{\,\mathrm{d}}$Contour methods allow for a principal value transformation into a different integral. This isn't exactly efficient, but I enjoyed working it through.
First map $x\mapsto x/a$ - then it suffices to show that: $$I:=\int_0^\infty\frac{x}{\cosh x}\d x=2G$$
Consider the contour $\gamma_{\rho,\varepsilon}$ which runs from $0\to\rho$, $\rho\to\rho+i\pi,\rho+i\pi\to i\pi$ and then on the journey $i\pi\to0$ we take a small semicircular indent at $\frac{i\pi}{2}$, where the indent is specifically the map $C_\varepsilon:[-\pi/2,\pi/2]\to\Bbb C$, $t\mapsto\frac{i\pi}{2}+\varepsilon e^{-it}$, not enclosing the pole at $\frac{i\pi}{2}$.
The integral on the small strip $\rho\to\rho+i\pi$ asymptotically vanishes: $$\begin{align}\left|i\int_0^\pi\frac{\rho+it}{e^\rho e^{it}+e^{-\rho}e^{-it}}\d t\right|&\lt2(\rho+\pi)\int_0^{\pi/2}|(e^\rho+e^{-\rho})\cos t+(e^\rho-e^{-\rho})i\sin(t)|^{-1}\d t\\&=2(\rho+\pi)\int_0^{\pi/2}\frac{1}{\sqrt{(e^\rho+e^{-\rho})^2+2\cos(2t)}}\d t\\&\lt2(\rho+\pi)\frac{\pi}{2}\frac{1}{e^\rho-e^{-\rho}}\\&=2\pi\cdot\frac{\rho+\pi}{\sinh\rho}\overset{\rho\to\infty}{\longrightarrow}0\end{align}$$
When we return $\rho+i\pi\to i\pi$, there is a negative effect due to $e^{i\pi}$ which balances out the negative from running "the opposite way", with contribution: $$\int_0^\rho\frac{i\pi}{e^x+e^{-x}}\d x+I_\rho$$
The integral on $C_\varepsilon$ is rather like the half-residue theorem, since the pole is simple: $$\int_{C_\varepsilon}\sim-\frac{1}{2}\int_{-\pi/2}^{\pi/2}(i\pi/2+\varepsilon e^{-it})\d t\sim-\frac{i\pi^2}{2}$$As $\varepsilon\to0^+$. For the non-indented section ($z=it$): $$\frac{1}{2}\left(\int_0^{\pi/2-\varepsilon}+\int_{\pi/2+\varepsilon}^\pi\right)t\sec t\d t\sim0-2\int_0^{\pi/2}\ln(\sec t+\tan t)\d t$$Bringing it all together and taking limits: $$2\int_0^\infty\frac{x}{e^x+e^{-x}}\d x+\frac{1}{2}\cdot\operatorname{pv}\int_0^\pi t\sec t\d t-\frac{i\pi^2}{2}+i\pi[\arctan\tanh(x/2)]_0^\infty=0$$So: $$\int_0^\infty\frac{x}{\cosh x}\d x=-\frac{1}{2}\cdot\operatorname{pv}\int_0^\pi t\sec t\d t=\int_0^{\pi/2}\ln(\sec t+\tan t)\d t$$
And the last is known to be $2G$.
