Use the trigonometric substitution $x(\theta)=\tan{\theta}$:
$$\int\frac{1}{\sqrt{x^2+1}}\,dx=
\int\frac{1}{\sqrt{[x(\theta)]^2+1}}x'(\theta)\,d\theta=\\
\int\frac{1}{\sqrt{\tan^2{\theta}+1}}\sec^2{\theta}\,d\theta=
\int\frac{\sec^2{\theta}}{\sqrt{\sec^2{\theta}}}\,d\theta=\\
\int\frac{\sec^2{\theta}}{|\sec{\theta}|}\,d\theta.
$$
Here, $-\frac{\pi}{2}<\theta<\frac{\pi}{2}$ because on that interval $\tan\theta$ gives you the entire real line and $\sec{\theta}\ge 1$ there. Therefore, $|\sec\theta|=\sec\theta$:
$$
\int\frac{\sec^2{\theta}}{|\sec{\theta}|}\,d\theta=
\int\frac{\sec^2{\theta}}{\sec{\theta}}\,d\theta=
\int\sec{\theta}\,d\theta.
$$
Now just use the following fact:
$$\int\sec{x}\,dx=\ln{|\tan{x}+\sec{x}|}+C.$$