$\int_0^{\infty} \arctan{\left(\frac{n}{\cosh{(x)}}\right)} \mathop{dx}$

Unfortunately, standard integration techniques will not help you solve this integral. The actual anti-derivative of this function is huge (according to Wolfram alpha at least, see: https://www.wolframalpha.com/input/?i=integral+arctan%281%2F%28cosh%28x%29%29%29 ). To combat this, will we use a method called Feynman Integration (named after the Physicist Richard Feynman. Although the actual rule was discovered by Leibniz - who independently discovered Calculus).

Let

$${I(t)=\int_{0}^{\infty}\arctan\left(\frac{t}{\cosh(x)}\right)dx}$$

So we have defined a function in terms of our integral. Using the Leibniz rule for integration we get

$${I'(t)=\int_{0}^{\infty}\frac{\text{sech}(x)}{t^2\text{sech}^2(x) + 1}dx}$$

(to take the derivative, you take take the partial derivative of the inside :D). The inner function now has an elementary anti-derivative; namely

$${\int\frac{\text{sech}(x)}{1+t^2\text{sech}^2(x)}dx=\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}} + C}$$

Hence the integral for ${I'(t)}$ can be found by taking limits:

$${\int_{0}^{\infty}\frac{\text{sech}(x)}{t^2\text{sech}^2(x) + 1}dx=\lim_{x\rightarrow \infty}\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}} - \lim_{x\rightarrow 0}\frac{-\arctan\left(\sqrt{t^2 + 1}\text{csch}(x)\right)}{\sqrt{1+t^2}}}$$

$${\Rightarrow I'(t) = \frac{\pi}{2}\frac{1}{\sqrt{1+t^2}}}$$

So to find ${I(t)}$ we now simply integrate with respect to ${t}$ and find the constant. This gives us

$${I(t)=\frac{\pi}{2}\int\frac{1}{\sqrt{t^2 + 1}}dt=\frac{\pi}{2}\sinh^{-1}(t) + C}$$

(${\int\frac{1}{\sqrt{1+t^2}}dt}$ is just a known integral).

But ${I(0)=0\Rightarrow C=0}$ (since ${\sinh^{-1}(0)=0}$), hence

$${\int_{0}^{\infty}\arctan\left(\frac{n}{\cosh(x)}\right)dx=\frac{\pi}{2}\sinh^{-1}(n)}$$, but

$${\sinh^{-1}(n)=\ln\left(\sqrt{n^2 + 1} + n\right)}$$

and so indeed

$${\int_{0}^{\infty}\arctan\left(\frac{n}{\cosh(x)}\right)dx=\frac{\pi}{2}\ln\left(\sqrt{n^2 + 1} + n\right)}$$


If $|n| \le 1$, we can use the Maclaurin series for $\arctan x$.

$$ \begin{align}\int_{0}^{\infty} \arctan \left( \frac{n}{\cosh x}\right) \, \mathrm dx &= \int_{0}^{\infty} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{2k+1} \left(\frac{n}{\cosh x} \right)^{2k+1} \mathrm dx \\ &= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \int_{0}^{\infty} \frac{1}{\cosh^{2k+1}(x)} \, \mathrm dx \\ &\stackrel{(1)}= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \frac{\sqrt{\pi}}{2} \frac{\Gamma (k+1/2)}{\Gamma(k+1)} \\ &\stackrel{(2)}= \sum_{k=0}^{\infty} \frac{(-1)^{k}n^{2k+1}}{2k+1} \frac{\sqrt{\pi}}{2} \frac{1}{\Gamma(k+1)} \frac{\Gamma(2k) \sqrt{\pi}}{2^{2k-1} \Gamma(k)} \frac{k}{k} \\ &= \frac{\pi}{2} \sum_{k=0}^{\infty}\frac{(-1)^{k} (2k)!}{2^{2k}(k!)^2} \frac{n^{2k+1}}{2k+1} \\&\stackrel{(3)}= \frac{\pi}{2} \operatorname{arsinh}(n) \end{align}$$


$(1)$ https://math.stackexchange.com/a/1379526/

$(2)$ https://mathworld.wolfram.com/LegendreDuplicationFormula.html

$(3)$ https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Series_expansions