Comentó sobre la sustitución de Weirstrass $$\begin{equation*}
t=\tan \frac{x}{2}\Leftrightarrow x=2\arctan t,\,dx=\frac{2}{
1+t^{2}}dt,
\end{ecuación *} $$ puede aplicarse a la integral dada. El integrando se convierte una fracción racional en $t$, ya $$\begin{equation*}
\cos x=\frac{1-\tan ^{2}\frac{x }{2}}{1+\tan ^{2}\frac{x}{2}}=\frac{1-t^{2}}{1+t^{2}},\,\quad\sin x=\frac{2\tan \frac{x }{2}}{1+\tan ^{2}
\frac{x }{2}}=\frac{2t}{1+t^{2}}.
\end{ecuación *} $$ contamos con $$\begin{eqnarray*}
I &=&\int \frac{1}{\cos x+\tan x}\,dx,\qquad t=\tan \frac{x}{2} \\
&=&\int \frac{2}{\left( \frac{1-t^{2}}{1+t^{2}}+\frac{2t}{1-t^{2}}\right)
\left( 1+t^{2}\right) }\,dt \\
&=&\int \frac{2(1-t^{2})}{t^{4}+2t^{3}-2t^{2}+2t+1}\,dt.
\end{eqnarray *} $$ desde $$\begin{equation*}
t^{4}+2t^{3}-2t^{2}+2t+1=\left( t^{2}+(1-\sqrt{5})t+1\right) \left( t^{2}+(1+\sqrt{5})t+1\right),
\end{ecuación *} $$ nos podemos expandir el integrando en fracciones parciales $$\begin{equation*}
\frac{2(1-t^{2})}{t^{4}+2t^{3}-2t^{2}+2t+1}=\frac{\sqrt{5}}{5}\left( \frac{2t+1+\sqrt{5}}{t^{2}+(1+\sqrt{5})t+1}-\frac{2t+1-\sqrt{5}}{t^{2}+(1-\sqrt{5})t+1}\right).
\end{ecuación *} $$ por lo tanto, $$ \begin{equation*}
I=\frac{\sqrt{5}}{5}\int \frac{2t+1+\sqrt{5}}{t^{2}+(1+\sqrt{5})t+1}\,dt-
\frac{\sqrt{5}}{5}\int \frac{2t+1-\sqrt{5}}{t^{2}+(1-\sqrt{5})t+1}\,dt.
\end{ecuación *} $$ $u(t)=t^{2}+(1+\sqrt{5})t+1,v(t)=t^{2}+(1-\sqrt{5})t+1$. Entonces $$\begin{eqnarray*}
I &=&\frac{\sqrt{5}}{5}\int \frac{u^{\prime }(t)}{u(t)}\,dt-\frac{\sqrt{5}}{5}\int \frac{v^{\prime }(t)}{v(t)}\,dt \\
&=&\frac{\sqrt{5}}{5}\log \left\vert u(t)\right\vert -\frac{\sqrt{5}}{5}\log
\left\vert v(t)\right\vert +C \\
&=&\frac{\sqrt{5}}{5}\log \left\vert \frac{t^{2}+(1+\sqrt{5})t+1}{t^{2}+(1-\sqrt{5})t+1}\right\vert +C \\
&=&\frac{\sqrt{5}}{5}\log \left\vert \frac{\tan ^{2}\frac{x}{2}+(1+\sqrt{5})\tan \frac{x}{2}+1}{\tan ^{2}\frac{x}{2}+(1-\sqrt{5})\tan \frac{x}{2}+1}\right\vert +C.
\end{eqnarray *} $$