The principal value has to be calculated for the following integral:
$$\int_{-\infty}^{\infty} \frac{\cos x}{ a^{2} - x^{2}}dx$$
for $a>0$ and $a$ is real. I set the pole to be $z=+a$ or $z=-a$, but I can't seem to get the required answer which is $π\sin(a)/a$. How can I go about solving this?
In general if you have a rational function $R(z)$ that vanishes at $\infty$ and has simple poles $x_1,\dots,x_n$ on the real axis, then for $f(z)=R(z)e^{iz}$ we get $$\lim_{r\to\infty}\mathcal{P}\int_{-r}^r f(x)dx=2\pi i\sum_{\operatorname{Im} a>0}\operatorname{Res}_af+\pi i\sum_{k=1}^n \operatorname{Res}_{x_k}f$$ (exercise: prove this using the residue theorem) Here $\mathcal{P}\int$ denotes the Cauchy principal value.
Now apply this to the case $R(z)=\frac{1}{a^2-z^2}$ and use the fact that $\operatorname{Re}\frac{e^{ix}}{a^2-x^2}=\frac{\cos(x)}{a^2-x^2}$ for real $x$.