<s>[INST] Indefinite integral $\int \frac {\mathrm d x} {p^2 + q^2 \cosh^2 a x}$ Spiegel's "Mathematical Handbook of Formulas and Tables" (Schaum, 1968), item $14.584$ gives:
$$\int \dfrac {\mathrm d x} {p^2 + q^2 \cosh^2 a x} = \begin{cases} \dfrac 1 {2 a p \sqrt {p^2 + q^2} } \ln \left({\dfrac {p \tanh a x + \sqrt {p^2 + q^2} } {p \tanh a x - \sqrt {p^2 + q^2} } }\right) + C \\ \dfrac 1 {a p \sqrt {p^2 + q^2} } \arctan \left({\dfrac {p \tanh a x} {\sqrt {p^2 + q^2} } }\right) + C \end{cases}$$
(As usual he glosses over negative argument to the $\ln$, but all you need to do is modulus it.)
He does not give the conditions under which either case holds. This is crucial.
First I multiplied top and bottom by $\operatorname {csch}^2 a x$, then used $\operatorname {csch}^2 a x = \coth^2 a x - 1$ for the bottom, then substituted $u = \coth a x$ to convert it into the form:
$$\frac 1 {a (p^2 + q^2) } \int \frac {\mathrm d u} {\frac {p^2} {p^2 + q^2} - u^2}$$
I can't see there is any other case than that $\dfrac {p^2} {p^2 + q^2}$ is positive, hence:
$$\frac 1 {a (p^2 + q^2) } \int \frac {\mathrm d u} {\left({\frac p {\sqrt {p^2 + q^2} } }\right)^2 - u^2}$$
This is a standard integral, giving:
$$\frac 1 {2 a p \sqrt {p^2 + q^2} } \ln \left|{\frac {\sqrt {p^2 + q^2} u - p} {\sqrt {p^2 + q^2} u + p} }\right| + C$$
which leads to:
$$\dfrac 1 {2 a p \sqrt {p^2 + q^2} } \ln \left({\dfrac {p \tanh a x + \sqrt {p^2 + q^2} } {p \tanh a x - \sqrt {p^2 + q^2} } }\right) + C$$
And that all works fine, no worries.
BUT, as far as I can see, there is no way to get to the arctangent result. To get there, we need $u^2 + k^2$ for some constant $k$, and I can't see how to get there from the given integrand.
 [/INST] Note
$$ \frac12\ln {\dfrac {p \tanh a x + \sqrt {p^2 + q^2} } {p \tanh a x - \sqrt {p^2 + q^2} } }
= \frac12\ln {\frac {\frac {p \tanh a x }{\sqrt {p^2 + q^2} }  + 1}{\frac{p \tanh a x }{\sqrt {p^2 + q^2} }-1}} 
=\tanh^{-1}\frac {p \tanh a x }{\sqrt {p^2 + q^2} }\\
$$
So, there is a typo in the second expression.
</s>