It is true, that for any $x\in \mathbb{R}\setminus \{-1,1\}$ there must exist a $k\in \mathbb{Z}$, such that $f(x) = \arctan(\frac{x}{1-x^2})+k\pi$, but we cannot simply assume that the same $k$ holds for all $x$.
If we have further information, such as the information that $f$ is continuous on $(-\infty, -1)\cup (-1,1)\cup (1,\infty)$, then we must have a fixed constant on each interval, meaning that
$$f(x) = \begin{cases} \arctan(\frac{x}{1-x^2}) + k_1\pi &,\text{for } x\in (-\infty,-1) \\
\arctan(\frac{x}{1-x^2}) + k_2\pi &,\text{for } x\in (-1,1) \\
\arctan(\frac{x}{1-x^2}) + k_3\pi &,\text{for } x\in (1,\infty) \end{cases}$$
And as you have already mentioned the initial condition $f(0)=\pi$ implies that $k_2=1$.
Now if we want to extend $f$ to a function on the entire real line in a way, such that it is continuous, then we must have
$$f(-1) = \lim_{x\:\uparrow \: -1}\arctan(\frac{x}{1-x^2}) +k_1 \pi = \lim_{x\:\downarrow \:-1} \arctan(\frac{x}{1-x^2}) + \pi$$
and
$$f(1) = \lim_{x\:\uparrow \: 1}\arctan(\frac{x}{1-x^2}) + \pi = \lim_{x\:\downarrow \: 1} \arctan(\frac{x}{1-x^2}) + k_3\pi$$
where $\lim_{x \: \uparrow a}$ and $\lim_{x \: \downarrow \: a}$ denotes left and right limits respectively. Using that, $\lim_{y\rightarrow -\infty}\arctan(y) = -\pi/2$ and $\lim_{y\rightarrow \infty} \arctan(y) = \pi/2$ we find that $f(-1) = \frac12 \pi$ and $f(1) = \frac{3}{2} \pi$ and therefore $k_1 = 0$ and $k_3 = 2$, thus finally we get that
$$f(x) = \begin{cases} \arctan(\frac{x}{1-x^2}) &,\text{for } x\in (-\infty,-1) \\
\frac12 \pi &,\text{for } x=-1 \\
\arctan(\frac{x}{1-x^2}) + \pi &,\text{for } x\in (-1,1) \\
\frac32 \pi &,\text{for } x=1 \\
\arctan(\frac{x}{1-x^2}) + 2\pi &,\text{for } x\in (1,\infty) \end{cases}$$