I encountered the following STEP II question on curve sketching $(2015, Q4)$
(i)
Consider the continuous function $f$ defined by: $$\tan(f(x))=x $$
where ${-\infty<x<\infty}$, and $f(0)=\pi.$Sketch the curve y=f(x).
This is essentially the curve $y=arctan(x)+\pi$.
(ii) The continuous function g is defined by $$\tan(g(x))=\frac{x}{1+x^2}$$ where $-\infty<x<\infty$, and $g(0)=\pi.$
Sketch the curves $y=\frac{x}{1+x^2}$ and $g=g(x)$
This question involves the composition of $\frac{x}{1+x^2}$ with $f(x)$ in (i).
Here's the part of the question that has encumbered me:
(iii) The continuous function $h$ is defined by $h(0)=\pi$ and $$\tan(h(x))=\frac{x}{1-x^2}$$ with $x \neq \pm1$.
(The values of $h(x)$ at $x=\pm1$ are such that $h(x)$ is continuous at these points.)
Sketch the curves $y=\frac{x}{1-x^2}$ and $h=h(x)$.
Succumbing to the same approach as (ii), I first sketched $y=\frac{x}{1-x^2}$, then composed $\frac{x}{1-x^2}$ with $f(x)$ of (i), but I encountered the following predicaments:
$1.$ I got two points for $h$ for each of $x=-1$ and $x=1$, they were $(x,h)=(-1,\frac{\pi}{2}),(-1,\frac{3\pi}{2})$ and $(x,h)=(1,\frac{\pi}{2}), (1,\frac{3 \pi}{2})$ respectively.
$2.$ From composition, I obtained a horizontal asymptote at $h=\pi$, but according to the mark scheme, the correct asymptotes occur at $h=0$ and $h=2\pi$ only. How can I get this $2\pi$?
$3.$ From differentiation, I got $$\frac{dh}{dx}(x,h)=h'=\frac{1+x^2}{(1-x^2)^2}cos^2(h)$$ by setting $h'=0$, I got $x=-1,+1, x \to -\infty,+\infty$ but none of these $x$ values yielded the correct horizontal asymtotes.
Can someone please explain where my conceptual errors lie?

$\newcommand{Arctanfrac}{\mathrm{Arctan}\!\left(\frac{x}{1-x^2}\right)}$
For each real number $x$ not including $\pm 1$, there are actually infinitely many solutions for $y$ to the equation
$$ \tan y = \frac{x}{1-x^2} $$
So we can write $h$ as
$$ h(x) = \Arctanfrac + k(x)\, \pi \tag{1}\label{eq:h} $$
where $\mathrm{Arctan}$ is the principal inverse of the $\tan$ function with range $-\frac{\pi}2 < \mathrm{Arctan}(a) < \frac{\pi}2$, and $k(x)$ is always an integer. But it's too soon to assume $k$ is a single constant over the entire real domain.
Since the given point is $h(0)=\pi$, first look at just the set $-1 < x < 1$ where the equations are all valid. Clearly $k(0)=1$. On this set, the $\mathrm{Arctan}$ expression is continuous, so for $h$ to be continuous, the integers $k(x)$ must all be the constant $1$. In other words,
$$ h(x) = \Arctanfrac + \pi \qquad \mathrm{ if } -1 < x < 1 $$
Next look at the one-sided limits in this known domain to find $h(-1)$ and $h(1)$.
$$ \begin{eqnarray*} \lim_{x \to -1^+} \frac{x}{1-x^2} &=& -\infty \\ \lim_{x \to -1^+} \Arctanfrac &=& -\frac{\pi}2 \\ \lim_{x \to -1^+} h(x) &=& \frac{\pi}2 \\ \lim_{x \to 1^-} \frac{x}{1-x^2} &=& +\infty \\ \lim_{x \to 1^-} \Arctanfrac &=& \frac{\pi}2 \\ \lim_{x \to 1^-} h(x) &=& \frac{3\pi}2 \end{eqnarray*} $$
So to make $h$ continuous, $h(-1) = \frac{\pi}2$ and $h(1) = \frac{3\pi}2$. Then these points will help determine $h$ on the remaining pieces of the domain $x<-1$ and $x>1$.
For $x<-1$, again Eq. $(\ref{eq:h})$ applies, and to make $h(x)$ continuous requires that $k(x)$ must be a single constant within the set $x<-1$, say $k(x) = k_1$ when $x<-1$. Then looking at the one-sided limit in this piece:
$$ \begin{eqnarray*} \lim_{x \to -1^-} \frac{x}{1-x^2} &=& +\infty \\ \lim_{x \to -1^-} \Arctanfrac &=& \frac{\pi}2 \\ \lim_{x \to -1^-} h(x) &=& \frac{\pi}2 + k_1 x \end{eqnarray*} $$
So to make $h$ continuous at $-1$, $k_1=0$.
I'll leave the details from here to you, but similarly on $x>1$ we need $k(x)=k_2=2$, so that
$$ h(x) = \begin{cases} \Arctanfrac & x < -1 \\ \frac{\pi}2 & x = -1 \\ \Arctanfrac + \pi & -1 < x < 1 \\ \frac{3\pi}2 & x = 1 \\ \Arctanfrac + 2\pi & x > 1 \end{cases} $$
This gives the horizontal asymptotes $h(x) \to 0$ as $x \to -\infty$ and $h(x) \to 2\pi$ as $x \to \infty$, matching your answer key.