I want to find $\displaystyle\int_{-\infty}^{\infty} \frac{\cos x}{x^{2} + a^{2}}\ dx$
using
$$\oint_{c} \frac{e^{ix}}{1+z^2} \cdot d z$$
over the upper half of a large semicircle enclosing $z=i$ (not $\oint_{c} \frac{e^{iz}}{1+z^{2}} dz$)
For very large semicircle, the above integral reduces to $$\oint \frac{e^{i x}}{1+z^{2}} d z=\int_{-\infty}^{\infty} \frac{e^{i x}}{1+x^{2}}dx=\int_{-\infty}^{\infty} \frac{\cos x d x}{1+x^{2}}+i \int_{-\infty}^{\infty} \frac{\sin x}{1+x^{2}} d x$$
So we have $$\oint \frac{e^{i x}}{1+z^{2}} d z=\int_{-\infty}^{\infty} \frac{\cos x}{1+x^{2}} d x+i\int_{-\infty}^{\infty} \frac{\sin x}{1+x^{2}} d x$$
Also by residue theorem $$\oint \frac{e^{i x}}{1+z^{2}} d z=2 \pi i b_{1}$$ and then
$$b_{1}=\lim _{z \rightarrow i} \frac{e^{i x}(z-i)}{1+z^{2}}=\frac{1}{2 i}$$ ( as $z$--> $i$ , the real part $x$--> $0$ )
Therefore we have$$\int_{-\infty}^{\infty} \frac{\cos x}{1+x^{2}} d x+\int_{-\infty}^{\infty} \frac{\sin x}{1+x^{2}} d x=\frac{2 \pi i}{2 i}$$
And hence $$\int_{-\infty}^{\infty} \frac{\cos x}{1+x^{2}} d x=\pi$$ which is incorrect.
Why am I getting wrong result. I suspect the above highlighted portion. Can anyone please help me. Thank you so much