Looking at Mathematica result $-\log\left( \cos\frac{t}{2}-\sin\frac{t}
{2}\right) +\log\left( \cos\frac{t}{2}+\sin\frac{t}{2}\right) $ and using
$\log\left( \frac{x}{y}\right) =\log x-\log y$ then Mathematica result can be written as
$$
\log\left( \frac{\cos\frac{t}{2}+\sin\frac{t}{2}}{\cos\frac{t}{2}-\sin
\frac{t}{2}}\right) =\log\left( \frac{1+\tan\frac{t}{2}}{1-\tan\frac{t}{2}
}\right)
$$
Using $\tan\frac{t}{2}=\frac{\sin t}{1+\cos t}$ then above becomes
\begin{align*}
\log\left( \frac{1+\frac{\sin t}{1+\cos t}}{1-\frac{\sin t}{1+\cos t}%
}\right) & =\log\left( \frac{1+\cos t+\sin t}{1+\cos t-\sin t}\right)
=\log\left( \frac{1+\sin t}{\cos t}\right) \\
& =\log\left( \frac{1}{\cos t}+\frac{\sin t}{\cos t}\right) =\log\left(
\sec t+\tan t\right)
\end{align*}
Which is what the book gives.
But interestingly, Rubi 4.7 gives different answer to this integral.
Clear[t];
mmaResult = Integrate[Cos[t] Tan[t]^2, t];
rubiResult = Int[Cos[t] Tan[t]^2, t];
Grid[{{Plot[mmaResult, {t, -2 Pi, 2 Pi}, PlotRange -> All,
PlotLabel -> Column[{"Mathematica", mmaResult}]],
Plot[rubiResult, {t, -2 Pi, 2 Pi}, PlotRange -> All, PlotLabel ->
Column[{"Rubi", rubiResult}]]
}}, Frame -> All]
Rubi gives ArcTanh[Sin[t]] - Sin[t]
It is left as an exercise to the reader to determine which is the correct answer.
v1 = Cos[t] Tan[t]^2; Integrate[v1, t]; D[v2, t] == v1 // Simplify
$\endgroup$