Rearranging terms
You can write the integral as
\begin{equation}
S=
{\displaystyle\int}
\ln\left(k\left(\mathrm{e}^{\mathrm{i}x}+\mathrm{e}^{-\mathrm{i}x}\right)+k^2+1\right)\,\mathrm{d}x
\end{equation}
Change of variable, $u = ix$ then $dx = -i du$, i.e.
\begin{equation}
S=
{\displaystyle\int}\ln\left(k\left(\mathrm{e}^{\mathrm{i}x}+\mathrm{e}^{-\mathrm{i}x}\right)+k^2+1\right)\,\mathrm{d}x
=-{{\mathrm{i}}}{\displaystyle\int}\ln\left(k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1\right)\,\mathrm{d}u
\end{equation}
Integrate by parts by choosing $f =\ln\left(k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1\right)$ and $g' = 1$, you shall get
\begin{equation}
S
=u\ln\left(k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1\right)-{\displaystyle\int}\dfrac{ku\left(\mathrm{e}^u-\mathrm{e}^{-u}\right)}{k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1}\,\mathrm{d}u
\tag{0}
\end{equation}
Now let's focus on $F={\displaystyle\int}\dfrac{ku\left(\mathrm{e}^u-\mathrm{e}^{-u}\right)}{k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1}\,\mathrm{d}u$, which can be written as
\begin{equation}
F
=
{\displaystyle\int}\dfrac{u\left(\mathrm{e}^{2u}-1\right)}{k\left(\mathrm{e}^{2u}+1\right)+\left(k^2+1\right)\mathrm{e}^u}\,\mathrm{d}u
\end{equation}
Take a change of variable $v= e^u$, you get
\begin{equation}
F
={\displaystyle\int}\dfrac{\left(v^2-1\right)\ln\left(v\right)}{v\left(kv^2+\left(k^2+1\right)v+k\right)}\,\mathrm{d}v
\end{equation}
Factor the denominator then apply partial fraction decomposition, you will get
\begin{equation}
F
=\underbrace{{\displaystyle\int}\dfrac{\ln\left(v\right)}{kv+1}\,\mathrm{d}v}_A+{{\dfrac{1}{k}}}\underbrace{{\displaystyle\int}\dfrac{\ln\left(v\right)}{v+k}\,\mathrm{d}v}_B-{{\dfrac{1}{k}}}\underbrace{{\displaystyle\int}\dfrac{\ln\left(v\right)}{v}\,\mathrm{d}v}_C
\tag{1}
\end{equation}
Solving $A$
For solving $A$, you need to integrate by parts first, by choosing $f = \ln v$, you get
\begin{equation}
A =\dfrac{\ln\left(v\right)\ln\left(kv+1\right)}{k}-{\displaystyle\int}\dfrac{\ln\left(kv+1\right)}{kv}\,\mathrm{d}v
\end{equation}
Solving the integral above by choosing $w = -kv$, you get
\begin{equation}
-{{\dfrac{1}{k}}}{\displaystyle\int}-\dfrac{\ln\left(1-w\right)}{w}\,\mathrm{d}w
=-\dfrac{\operatorname{Li}_2\left(w\right)}{k}
=-\dfrac{\operatorname{Li}_2\left(-kv\right)}{k}
\end{equation}
So, $A$ becomes
\begin{equation}
A =\dfrac{\ln\left(v\right)\ln\left(kv+1\right)}{k}+\dfrac{\operatorname{Li}_2\left(-kv\right)}{k}
\end{equation}
Solving $B$
Choose $w = v+k$, then
\begin{equation}
B ={\displaystyle\int}\dfrac{\ln\left(1-\frac{w}{k}\right)}{w}\,\mathrm{d}w+{{\ln\left(-k\right)}}{\displaystyle\int}\dfrac{1}{w}\,\mathrm{d}w
\end{equation}
For the first integral above choose $y = \frac{w}{k}$, you will get
\begin{equation}
{\displaystyle\int}\dfrac{\ln\left(1-\frac{w}{k}\right)}{w}\,\mathrm{d}w
=-{\displaystyle\int}-\dfrac{\ln\left(1-y\right)}{y}\,\mathrm{d}y
\end{equation}
Using a very similar technique as we did with $A$, we get
\begin{equation}
B =\ln\left(-k\right)\ln\left(v+k\right)-\operatorname{Li}_2\left(\dfrac{v+k}{k}\right)
\end{equation}
Solving $C$
For $C = {\displaystyle\int}\dfrac{\ln\left(v\right)}{v}\,\mathrm{d}v$, this one is easy just choose $w = \ln v$, you get
\begin{equation}
{\displaystyle\int}\dfrac{\ln\left(v\right)}{v}\,\mathrm{d}v
={\displaystyle\int}w\,\mathrm{d}w
=
\frac{w^2}{2}
=\dfrac{\ln^2\left(v\right)}{2}
\end{equation}
Undoing the change of variables
Plugging all these integrals back in $(1)$, we get
\begin{equation}
F=\dfrac{\ln\left(v\right)\ln\left(kv+1\right)}{k}-\dfrac{\operatorname{Li}_2\left(\frac{v+k}{k}\right)}{k}+\dfrac{\ln\left(-k\right)\ln\left(v+k\right)}{k}+\dfrac{\operatorname{Li}_2\left(-kv\right)}{k}-\dfrac{\ln^2\left(v\right)}{2k}
\end{equation}
Undo the change of variable $v = e^u$, you will get
\begin{equation}
F =\dfrac{u\ln\left(k\mathrm{e}^u+1\right)}{k}-\dfrac{\operatorname{Li}_2\left(\frac{\mathrm{e}^u+k}{k}\right)}{k}+\dfrac{\ln\left(-k\right)\ln\left(\mathrm{e}^u+k\right)}{k}+\dfrac{\operatorname{Li}_2\left(-k\mathrm{e}^u\right)}{k}-\dfrac{u^2}{2k}
\end{equation}
Plug back in equation $(0)$, we get
\begin{equation}
S
=u\ln\left(k\left(\mathrm{e}^u+\mathrm{e}^{-u}\right)+k^2+1\right)-u\ln\left(k\mathrm{e}^u+1\right)+\operatorname{Li}_2\left(\dfrac{\mathrm{e}^u+k}{k}\right)-\ln\left(-k\right)\ln\left(\mathrm{e}^u+k\right)-\operatorname{Li}_2\left(-k\mathrm{e}^u\right)+\dfrac{u^2}{2}
\end{equation}
Undo $u=ix$, we finalize by saying
\begin{equation}
S
=\left(x+\mathrm{i}\left(\ln\left(k\right)+\ln\left(-1\right)\right)\right)\ln\left(\left|\mathrm{e}^{\mathrm{i}x}+k\right|\right)-\mathrm{i}\operatorname{Li}_2\left(\dfrac{\mathrm{e}^{\mathrm{i}x}+k}{k}\right)+\mathrm{i}\operatorname{Li}_2\left(-k\mathrm{e}^{\mathrm{i}x}\right)-\dfrac{\mathrm{i}x^2}{2}+C
\end{equation}