<s>[INST] How to calculate $\int \frac{\cos^2 x}{1 + \sin^2 x}dx$ My approach was to use a double-arc formula for cosine and sine, but I did not succeed.
$\sin^2 x = \frac{1 - \cos(2x)}{2}$ and $\cos^2x = \frac{1 + \cos(2x)}{2}$
 [/INST] Note that we can write
$$\begin{align}
\frac{\cos^2(x)}{1+\sin^2(x)}&=\frac{1+\cos(2x)}{3-\cos(2x)}\\\\
&=\frac{4-(3-\cos(2x))}{3-\cos(2x)}\\\\
&=-1+\frac{4}{3-\cos(2x)}
\end{align}$$
Enforce the substitution $y=\tan(x)$, so that $\cos(2x)=\frac{1-y^2}{1+y^2}$ and $dx=\frac1{1+y^2}\,dy$.  Proceeding reveals 
$$\begin{align}
\int\frac{4}{3-\cos(2x)}\,dx&=\int \frac{2}{1+2y^2}\,dy\\\\
&=\sqrt2\arctan(\sqrt2\,y)+C\\\\
&=\sqrt{2}\arctan(\sqrt2 \tan(x))+C
\end{align}$$
Putting it all together yield
$$\int \frac{\cos^2(x)}{1+\sin^2(x)}\,dx=-x+\sqrt{2}\arctan(\sqrt2 \tan(x))+C$$
</s>