Prove that $\tan^{-1}\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}=\frac{\pi}{4}+\frac 12 \cos^{-1}x^2$

Because for $x\neq0$ and $-1\leq x\leq1$ easy to see that: $$0<\frac{\pi}{4}+\frac 12 \cos^{-1}x^2<\frac{\pi}{2}$$ and we obtain: $$\tan\left(\frac{\pi}{4}+\frac 12 \cos^{-1}x^2\right)=\frac{1+\tan\frac{1}{2}\arccos{x^2}}{1-\tan\frac{1}{2}\arccos{x^2}}=$$ $$=\frac{\cos\frac{1}{2}\arccos{x^2}+\sin\frac{1}{2}\arccos{x^2}}{\cos\frac{1}{2}\arccos{x^2}-\sin\frac{1}{2}\arccos{x^2}}=\frac{\sqrt{\frac{1+x^2}{2}}+\sqrt{\frac{1-x^2}{2}}}{\sqrt{\frac{1+x^2}{2}}-\sqrt{\frac{1-x^2}{2}}}=\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}.$$

Your mistake in the last line.

Indeed, since $$\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}>1$$ and from here $$\frac{\pi}{4}<\phi<\frac{\pi}{2},$$ we obtain: $$2\phi=\pi-\arcsin{x^2}=\frac{\pi}{2}+\arccos{x^2}.$$


A bit late answer but I thought worth mentioning it.

First note that we can substitute $y=x^2$ and consider $0<y\leq 1$. Furthermore, the argument of $\arctan$ can be simplified as follows:

$$\frac{\sqrt{1+y}+\sqrt{1-y}}{\sqrt{1+y}-\sqrt{1-y}}=\frac{1+\sqrt{1-y^2}}{y}$$

Now, setting $y = \cos t$ for $t \in \left[0,\frac{\pi}2\right)$, to show is only

$$\arctan \frac{1+\sin t}{\cos t} = \frac{\pi}{4}+\frac t2$$

At this point half-angle formulas come into mind:

$$\frac{1+\sin t}{\cos t} = \frac{(\cos \frac t2 + \sin \frac t2)^2}{\cos^2 \frac t2 - \sin^2 \frac t2} = \frac{\cos \frac t2 + \sin \frac t2}{\cos \frac t2 - \sin \frac t2}$$ $$ = \frac{1+\tan \frac t2}{1-\tan \frac t2} = \tan\left(\frac{\pi}{4}+\frac t2\right)$$.

Done.