I want to compute $\int_0^\infty \frac{x^t}{1+x^2}dx \; \forall t \in (-1,1)$ using residue theroem. I want to compute $$\int_0^\infty \frac{x^t}{1+x^2}dx \qquad \forall t \in (-1,1)$$
using residue theroem.
I consider $$f(z) = \frac{z^t}{1+z^2}$$
I find two pole of order 1 in $z=i$ and $z=-i$
with $$\text{Res}(f,i) = \frac{e^{it\frac{\pi}{2}}}{2i}$$
$$\text{Res}(f,-i) = -\frac{e^{it\frac{3\pi}{2}}}{2i}$$
So by residue theroem, I expect that
$$\int_0^\infty \frac{x^t}{1+x^2}dx = 2\pi i(\text{Res}(f,i)+\text{Res}(f,-i))$$
but the expected fromula in the correction is 
$$\int_0^\infty \frac{x^t}{1+x^2}dx = \frac{2\pi i}{1-e^{2\pi i (t-1)}}(\text{Res}(f,i)+\text{Res}(f,-i))$$
and I don't understand what I have missed
 A: The residue theorem really states that
$$\oint_C dz \frac{x^t}{1+x^2} = i 2 \pi \sum_{\pm} \operatorname*{Res}_{z=\pm i} \frac{x^t}{1+x^2} $$
where $C$ is a keyhole contour of outer radius $R$ and inner radius $\epsilon$ about the positive real axis.  So you need to write out the contour integral as a parametrization of the integral about each segment of the contour as follows:
$$\int_0^{R} dx \frac{x^t}{1+x^2} + i R \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{R^t e^{i t \theta}}{1+R^2 e^{i 2 \theta}} \\ + e^{i 2 \pi t}\int_R^0 dx \frac{x^t}{1+x^2} + i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\epsilon^t e^{i t \phi}}{1+\epsilon^2 e^{i 2 \phi}}$$
We now consider the case where $R \to\infty$.  In this case, the second integral has a magnitude bounded by $2 \pi R^{-(1-t)}$, which vanishes in this limit because $t \lt 1$.
We also consider the case where $\epsilon \to 0$.  Here, the fourth integral has magnitude bounded by $2 \pi \epsilon^{1+t}$, which vanishes because $t \gt -1$.  Thus, we are left with the sum of the first and third integrals equaling the RHS of the first equation:
$$\left (1-e^{i 2 \pi t} \right ) \int_0^{\infty} dx \frac{x^t}{1+x^2} = i 2 \pi \sum_{\pm} \operatorname*{Res}_{z=\pm i} \frac{x^t}{1+x^2}$$
The rest you seemed to handle fine.
