<s>[INST] How to prove $\int_0^\infty \ln(1+\frac{z}{\cosh(x)})dx=\frac{\pi^2}{8}+\frac{(\cosh^{-1}(z))^2}{2},z\ge1$ and a closed form for $-1I observed graphically that $$f(z)=\int_0^\infty \ln\left(1+\frac{z}{\cosh(x)}\right)dx=\frac{\pi^2}{8}+\frac{(\cosh^{-1}(z))^2}{2},z\ge1$$
Can anyone explain why this holds? I tried differentiating with respect to $z$ but I didn't really know how to continue further.
Also, if anyone knows how to obtain a closed form of $f(z)$ for $-1<z<1$ it would be greatly appreciated as I'm curious about specific values such as $f(-\frac{1}{2})=-\frac{7\pi^2}{72}$ and $f(\frac{1}{2})=\frac{5\pi^2}{72}.$
 [/INST] Here is a more direct way.
The first thing to note is the function $f(z)$ is continuous for all $z > - 1$, including at the point $z = 1$.
From
$$f(z) = \int_0^\infty \ln (1 + z \operatorname{sech} x) \, dx,$$
on differentiating with respect to $z$ we have
\begin{align}
f'(z) &= \int_0^\infty \frac{\operatorname{sech} x}{1 + z \operatorname{sech}} \, dx\\
&= \int_0^\infty \frac{dx}{\cosh x + z}\\
&= 2 \int_0^\infty \frac{e^x}{e^{2x} + 2z e^x + 1} \, dx.
\end{align}
In the last line we have used the fact that $\cosh x = (e^{x} + e^{-x})/2$.
Making a substitution of $u = e^x, du = e^x \, dx$ leads to
$$f'(z) = 2 \int_1^\infty \frac{du}{(u + z)^2 + 1 - z^2}. \qquad (*)$$

Case 1: $-1 < z < 1$
For this case, as the term $(1 - z^2)$ will be positive we can write ($*$) as:
\begin{align}
f'(z) &= 2 \int_1^\infty \frac{du}{(u + z)^2 + (\sqrt{1 - z^2})^2}\\
&= \frac{2}{\sqrt{1 - z^2}} \left [\tan^{-1} \left (\frac{u + z}{\sqrt{1 - z^2}} \right ) \right ]_1^\infty\\
&= \frac{\pi}{\sqrt{1 - z^2}} - \frac{2}{\sqrt{1 - z^2}} \tan^{-1} \left (\frac{1 + z}{\sqrt{1 - z^2}} \right )\\
&= \frac{\pi}{\sqrt{1 - z^2}} - \frac{2}{\sqrt{1 - z^2}} \left [\frac{\pi}{2} - \tan^{-1} \left (\frac{\sqrt{1 - z^2}}{1 + z} \right ) \right ]\\
&= \frac{2}{\sqrt{1 - z^2}} \tan^{-1} \left (\frac{\sqrt{1 - z^2}}{1 + z} \right ), \qquad (**)
\end{align}
where we have made use of the result $\tan^{-1} (x) = \pi/2 - \tan^{-1} (1/x)$ for $x > 0$. 
Noting that
$$\tan \left (\frac{1}{2} \cos^{-1} z \right ) = \frac{\sqrt{1 - z^2}}{1 + z},$$
the result in ($**$) can be rewritten as
$$f'(z) = \frac{1}{\sqrt{1 - z^2}} \cos^{-1} z.$$
Integrating up with respect to $z$ it is readily seen that
$$f(z) = \int \frac{\cos^{-1} z}{\sqrt{1 - z^2}} \, dz = -\frac{1}{2} (\cos^{-1} z )^2 + C.$$
To find the constant $C$, choosing $z= 0$ we see that $f(0) = 0$. Thus $C = \pi^2/8$, leading to
$$f (z) = \frac{\pi^2}{8} - \frac{1}{2} (\cos^{-1} z)^2, \, -1 < z < 1. \qquad (\dagger)$$

Case 2: $z > 1$
For this case, as the term $(1 - z^2)$ will be negative we can write ($*$) as:
\begin{align}
f'(z) &= 2 \int_1^\infty \frac{du}{(u + z)^2 - (\sqrt{z^2 - 1})^2}\\
&= -\frac{2}{\sqrt{z^2 - 1}} \left [\coth^{-1} \left (\frac{u + z}{\sqrt{z^2 - 1}} \right ) \right ]_1^\infty\\
&= \frac{2}{\sqrt{z^2 - 1}} \coth^{-1} \left (\frac{1 + z}{\sqrt{z^2 - 1}} \right )\\
&= \frac{2}{\sqrt{z^2 - 1}} \tanh^{-1} \left (\frac{\sqrt{z^2 - 1}}{z+ 1} \right ), \qquad (***)
\end{align}
where we have made use of the result $\coth^{-1} (x) = \tanh^{-1} (1/x), x \neq 0$.
Noting that
$$\tanh \left (\frac{1}{2} \cosh^{-1} z \right ) = \frac{\sqrt{z^2 - 1}}{z + 1},$$
the result in ($***$) can be written as
$$f'(z) = \frac{1}{\sqrt{z^2 - 1}} \cosh^{-1} z.$$
Integrating up with respect to $z$ it is readily seen that
$$f(z) = \int \frac{\cosh^{-1} z}{\sqrt{z^2 - 1}} \, dz = \frac{1}{2} (\cosh^{-1} z)^2 + C.$$
To find the unknown constant $C$, as the function $f(z)$ is continuous for all $z > - 1$, for $f$ to be continuous at $z = 1$, from ($\dagger$) we require $f(1) = \pi^2/8$. Thus $C = \pi^2/8$, leading to
$$f(z) = \frac{\pi^2}{8} + \frac{1}{2} (\cosh^{-1} z)^2, \qquad z > 1.$$
</s>