Answer
$$\frac{1}{\sqrt{2}}\tan^{-1}\left(\frac{\tan \theta }{\sqrt{2}}\right)+C$$
Work Step by Step
\begin{aligned}
\int \frac{d \theta}{1+\cos ^{2} \theta}&= \int \frac{d \theta}{\cos ^{2}\theta (\frac{1}{\cos ^{2} }+1)}\\
&= \int \frac{\sec^2 \theta d \theta}{ (\sec^2 \theta +1)}\\
&= \int \frac{\sec^2 \theta d \theta}{ \tan^2 \theta +2}
\end{aligned}
Let $$ u=\tan \theta \ \ \ \ \ du = \sec^2 \theta d\theta $$
Then
\begin{aligned}
\int \frac{d \theta}{1+\cos ^{2} \theta}&= \int \frac{d \theta}{\cos ^{2}\theta (\frac{1}{\cos ^{2} }+1)}\\
&= \int \frac{\sec^2 \theta d \theta}{ (\sec^2 \theta +1)}\\
&= \int \frac{\sec^2 \theta d \theta}{ \tan^2 \theta +2} \\
&= \int \frac{du}{u^2+2}\\
&=\frac{1}{\sqrt{2}}\tan^{-1}\left(\frac{u}{\sqrt{2}}\right)+C\\
&= \frac{1}{\sqrt{2}}\tan^{-1}\left(\frac{\tan \theta }{\sqrt{2}}\right)+C
\end{aligned}