I have function $\int_{-1}^{1}\frac{\sqrt{1-x^2}}{1+x^2}dx$. Here to use residue thm, I rewrite the integral as $\int_{-1}^{1}\frac{\sqrt{1-z^2}}{1+z^2}dz$ with the poles $z=i$ and $-i$. However there is a given condition $-1<x<1$, so it means $z^2<1$. This is the problem because when the poles are at $|z|=1$. It's outside the boundary. So I have no idea about how I can calculate this integral
Here's my Residues
$\operatorname{Res}_{z=i}[f(z)]=\lim_{z\to i}\frac{\sqrt{1-z^2}}{i(1-zi)}dz=\frac{\sqrt{2}}{2i}$
$\operatorname{Res}_{z=-i}[f(z)]=\lim_{z\to -i}\frac{\sqrt{1-z^2}}{i(1+zi)}dz=\frac{\sqrt{2}}{2i}$
But I guess these are wrong
Edit: since I need a closed contour i replaced $x=cos\theta$ and $dx=-sin\theta d\theta$
And my integral is now $-\frac{1}{2}\oint \frac{\sqrt{1-cos^2\theta}}{cos^20+cos^2\theta}(-sin\theta) d\theta$= $-\frac{1}{2}\oint \frac{-sin^2\theta}{cos^20+cos^2\theta}d\theta$
Time for the dog-bone contour (dumbbell contour), which works perfectly. Indeed, consider the contour $\mathcal{C}$ given as follows:
$\hspace{12em}$
With the principal branch cut, as the radius/band-width of $\mathcal{C}$ goes to zero,
\begin{align*} \oint_{\mathcal{C}} \frac{i\sqrt{z-1}\sqrt{z+1}}{i(z^2+1)} \, dz &\longrightarrow \int_{-1-0^+i}^{1-0^+i} \frac{i\sqrt{z-1}\sqrt{z+1}}{z^2+1} \, dz - \int_{-1+0^+i}^{1+0^+i} \frac{i\sqrt{z-1}\sqrt{z+1}}{z^2+1} \, dz \\\\ &\quad = 2\int_{-1}^{1} \frac{\sqrt{1-x^2}}{x^2+1} \, dx. \end{align*}
On the other hand, Residue Theorem tells that
\begin{align*} \oint_{\mathcal{C}} \frac{i\sqrt{z-1}\sqrt{z+1}}{z^4+1} \, dz &= - 2\pi i \sum_{z_k \ : \ z_k^2 + 1 = 0} \underset{z=z_k}{\mathrm{Res}} \, \frac{i\sqrt{z-1}\sqrt{z+1}}{z^2+1} \\\\ &= 2\pi (\sqrt{2}-1) \end{align*}
(In order to use Residue Theorem, consider a large circle, apply Residue Theorem to the region enclosed by this circle and $\mathcal{C}$, and then let the radius of the circle go to $\infty$.) Therefore
$$ \int_{-1}^{1} \frac{\sqrt{1-x^2}}{x^2+1} \, dx = \pi (\sqrt{2}-1) $$