Using the principal branch, we can write the integral $\oint_C \frac{z^a}{z^2+1}\,dz$, where $C$ is comprised of (i) the real line segment from $-R$ to $R$ and (ii) the semi-circle in the upper-half plane, centered at the origin and with radius $R$, as
$$\begin{align}
\oint_C \frac{z^a}{z^2+1}\,dz&=\int_{-R}^0 \frac{x^a}{x^2+1}\,dx+\int_0^R \frac{x^a}{x^2+1}\,dx+\int_0^\pi \frac{(Re^{i\phi})^a}{(Re^{i\phi}))^2+1}\,(iRe^{i\phi}))\,d\phi\\\\
&=(1+e^{i\pi a})\int_0^R \frac{x^a}{x^2+1}\,dx+\int_0^\pi \frac{(Re^{i\phi})^a}{(Re^{i\phi}))^2+1}\,(iRe^{i\phi}))\,d\phi\tag1
\end{align}$$
As $R\to \infty$ the second integral on the right-hand side of $(1)$ approaches $0$. Hence, taking this limit and invoking the reside theorem we find that
$$\begin{align}
\int_0^R \frac{x^a}{x^2+1}\,dx&=\frac1{1+e^{i\pi a}}\,(2\pi i) \text{Res}\left(\frac{z^a}{z^2+1}, z=i\right)\\\\
&=\frac{\pi e^{i\pi a/2}}{1+e^{i\pi a}}\\\\
&=\frac{\pi}{2\cos(\pi a/2)}
\end{align}$$