WolframAlpha gives a real closed form for this definite integral: $$\int_{-\infty}^{+\infty } \arctan\left(\dfrac{1}{1+x^2}\right)dx = \sqrt{2\left(\sqrt{2}-1\right)}\;\pi$$
Yet, the formula it gives for the indefinite integral uses $i$.
$$\int \tan^{-1}\left(\frac{1}{x^2 + 1}\right) dx = x \tan^{-1}\left(\frac{1}{x^2 + 1}\right) + 2 \left( \frac{\tan^{-1}\left(\frac{x}{\sqrt{1 - i}}\right)}{(1 - i)^{3/2}} + \frac{\tan^{-1}\left(\frac{x}{\sqrt{1 + i}}\right)}{(1 + i)^{3/2}} \right) + C$$
Why isn't the definite integral non-real?
First of all, it is real because it converges and because $\arctan\left(\frac1{1+x^2}\right)$ is a real number for every $x\in \mathbb R$.
On the other hand, that some number can be represented with an expression involving $i$ doesn't mean it is not a real number. For instance, $$\frac1i+i=0\in \mathbb R.$$