I want to solve this complex integral:
$\displaystyle\int_{C(0,2)} \frac{e^{\frac{i\pi z}{2}}}{z^2+1}$
Where $C(0,2)$ is the circle of center $z=0$ and radius 2.
I believe I can't directly apply the Cauchy integral formula $f(z)=\frac{1}{2\pi i}\displaystyle\int_\gamma \frac{f(z)}{z-z_0}$ as the division of the denominator yields $(z-i)(z+i)$ and both $i$ and $-i$ are inside $C(0,2)$. So I'm a bit lost with what theorem I should apply. Any help is welcome!
Notation
Usually we write closed integrals with a circle. This is not a must but indicates that the path is closed. Also a circle of center $z=0$ and radius $2$ can be written as $\lvert z\rvert =2$. So $$\int_{C(0,2)} \frac{e^{\frac{i\pi z}{2}}}{z^2+1}\, \mathrm{d}z \equiv \oint_{\lvert z\rvert =2} \frac{e^{\frac{i\pi z}{2}}}{z^2+1}\, \mathrm{d}z.$$
For simplification purposes we will define $f(z):=\frac{e^{\frac{i\pi z}{2}}}{z^2+1}$.
The residue theorem $$\oint_\gamma f(z)\, dz = 2\pi i \sum_{k=1}^n \operatorname{I}(\gamma, a_k) \operatorname{Res}( f, a_k )$$ For further information look here.
Calculating a residue
Let $z_0$ be a pole of order $n$, then the residue of $f$ around $z = z_0$ is $$\operatorname{Res}_{z_0} f = \frac{1}{\left(n-1\right)!}\lim_{z\rightarrow a}\frac{\partial^{n-1}}{\partial z^{n-1}}[(z-a)^nf(z)].$$
Your integral
We have two different solutions, since you did not specify if the circle goes counterclockwise or clockwise. We will calculate the counterclockwise option first. The other solution can be obtained by multiplying $-1$.
$$\oint_{\lvert z\rvert =2} \frac{e^{\frac{i\pi z}{2}}}{z^2+1}\, \mathrm{d}z=2\pi i\left[\operatorname{Res}_{z=i}(f)+\operatorname{Res}_{z=-i}(f)\right]$$
We have $$\operatorname{Res}_{z=i}(f)=-i\frac{e^{\frac{i\pi \cdot i}{2}}}{2}=\frac{-i}{2}e^{-\pi/2}$$ and $$\operatorname{Res}_{z=-i}(f)=\frac{i}{2}{e^{\frac{i\pi \cdot (-i)}{2}}}{2}=\frac{i}{2}e^{\pi/2}.$$