It is straightforward to see that $f(x)=\pi-2\arctan(x)$ for all $x\geq 0$.

Indeed, let $t=\arctan(x)$ so that $0\leq t<\pi/2$ and $x=\tan(t)$. Then
$$\frac{2x}{1-x^2}=\frac{2\tan(t)}{1-\tan^2(t)}=\tan(2t),$$
hence
$$\arctan\left(\frac{2x}{1-x^2}\right)=
\begin{cases}
2t,& 0\leq x<1;\\
2t-\pi,& x>1.
\end{cases}$$