Solution (source code)

= Solution

Put $a=1/n$, so $0<a<1$, and write $I(a)=\int_0^\infty x^a/(1+x^2)\,dx$. Choose the <branch of the complex logarithm> with $-\pi/2<\arg z<3\pi/2$, whose cut is the downward imaginary axis. Define $z^a=\exp(a\operatorname{Log}z)$ and integrate $z^a/(1+z^2)$ along the positively oriented upper semicircle, indented above zero. The straight pieces run from $-R$ to $-\varepsilon$ and from $\varepsilon$ to $R$; the small arc runs clockwise from argument $\pi$ to zero.

On the negative real axis $z^a=|z|^ae^{i\pi a}$, so the two straight pieces tend to $(1+e^{i\pi a})I(a)$. The outer arc is $O(R^{a-1})$ and the inner arc is $O(\varepsilon^{a+1})$, both tending to zero. The only enclosed <pole> is $i$, with <residue> $e^{i\pi a/2}/(2i)$. The <residue theorem> therefore gives
$$
(1+e^{i\pi a})I(a)=\pi e^{i\pi a/2}.
$$
Using $1+e^{i\pi a}=2e^{i\pi a/2}\cos(\pi a/2)$ yields
$$
\boxed{I(1/n)=\frac{\pi}{2\cos(\pi/(2n))}.}
$$
The same bounds show convergence of the real integral at both zero and infinity.