It is well known that $$\int\frac{1}{1+x^2}\,\mathrm{d}x=\tan^{-1}x+C \tag{1}$$
However, I integrated this differently and got an unusual result.
Suppose we make the substitution $x=\sinh\theta$ and $\mathrm{d}x=\cosh\theta\,\mathrm{d}\theta$ so the integral becomes $$\int\frac{\cosh\theta}{\cosh^2\theta}\,\mathrm{d}\theta=\int\frac{1}{\cosh\theta}\,\mathrm{d}\theta \tag{2}$$
By the definition of $\cosh\theta$, we can rewrite this as $$\int\frac{2e^\theta}{e^{2\theta}+1}\,\mathrm{d}\theta=2\tan^{-1}e^\theta+C \tag{3}$$
Using the fact that $e^\theta=\cosh\theta+\sinh\theta$, we get $e^\theta=x+\sqrt{1+x^2}$, so the answer is then $$2\tan^{-1}\left(x+\sqrt{1+x^2}\right)+C \tag{4}$$
Equating $(4)$ with $(1)$, we have $$2\tan^{-1}\left(x+\sqrt{1+x^2}\right)+C=\tan^{-1}x \tag{5}$$
Plugging in $x=0$, we find $C=-\frac\pi2$. We now have the following strange relationship
$$\tan^{-1} x= 2\tan^{-1}\left(x+\sqrt{1+x^2}\right)-\frac\pi2 \tag{$\star$}$$ This leads me to wonder: Why is this true geometrically, and does this relationship extend into the complex plane?
The geometric interpretation could be found in the figure below.
We have $\alpha = \frac{\pi}{2} - \arctan x , ~\beta = \frac{\pi}{2} - \arctan \left(x + \sqrt{1 + x^2}\right)$, and $\alpha = 2 \beta$.
Combining these three equations would lead to your results.
For a formal proof, let $\theta = \arctan \left(x + \sqrt{1 + x^2}\right)$. Since
$$ x + \sqrt{1 + x^2} \geq \sqrt{1 + x^2} - |x| > 0,$$
we have $\theta \in (0, \frac{\pi}{2})$.
Also, note that
$$ \begin{align} \tan\left(2\theta - \frac{\pi}{2}\right)&= -\frac{1}{\tan(2\theta)}\\ &= -\frac{1 - \tan^2 \theta}{2 \tan \theta}\\ &= -\frac{1 - \left(x + \sqrt{1 + x^2}\right)^2}{2 \left(x + \sqrt{1 + x^2}\right)}\\ &= x. \end{align} $$ As $\left(2\theta - \frac{\pi}{2}\right) \in (-\frac{\pi}{2}, \frac{\pi}{2})$, i.e., $\left(2\theta - \frac{\pi}{2}\right)$ lies in the range of $\arctan(\cdot)$, we know that $$ \arctan x = 2\theta - \frac{\pi}{2} = 2\arctan \left(x + \sqrt{1 + x^2}\right) - \frac{\pi}{2}. $$