Complex Integration poles real axis
Define
$$f(z):=\frac{e^{iaz}}{z^2-b^2}\;,\;a,b\in\Bbb R^+\;,$$
$$C_R:=[-R,-b-\epsilon]\cup\gamma_{-b,\epsilon}\cup[-b+\epsilon,b-\epsilon]\cup\gamma_{b\epsilon}\cup[b+\epsilon,R]\cup\Gamma_R$$
with
$$\gamma_{r,s}:=\{r+se^{it}\;;\;0\le t\le \pi\}\;,\;r,s\in\Bbb R^+\;,\;\Gamma_R:=\{Re^{it}\;;\;0\le t\le \pi\}\;,\;\;R\in\Bbb R^+$$
Since $\;f(z)\;$ analytic on and within $\;C_R\;$ , we get
$$\oint\limits_{C_R}f(z)\,dz=0$$
By the corollary to the lemma in the second answer here we get
$$\begin{align*}\lim_{\epsilon\to 0}\int\limits_{\gamma_{-b,\epsilon}}f(z)dz&=i\pi\,\text{Res}\,(f)_{z=-b}=i\pi\frac{e^{-iab}}{-2b}=-\frac{\pi i}{2b}e^{-iab}\\ \lim_{\epsilon\to 0}\int\limits_{\gamma_{b,\epsilon}}f(z)dz&=i\pi\,\text{Res}\,(f)_{z=b}=i\pi\frac{e^{iab}}{2b}=\frac{\pi i}{2b}e^{iab}\end{align*}$$
And applying Jordan's Lemma the integral on $\;\Gamma_R\;$ goes to zero when $\;R\to \infty\;$ , so in the end
$$0=\lim_{R\to\infty\,,\,\epsilon\to 0}\oint\limits_{C_R}f(z)dz=\int\limits_{-\infty}^\infty f(x)dx-\frac{\pi i}{2b}\left(e^{iab}-e^{-iab}\right)\implies$$
$$\implies \int\limits_{-\infty}^\infty f(x)dx=-\frac\pi b\frac{e^{iab}-e^{-iab}}{2i}=-\frac\pi b\sin(ab)$$
and I get the same as you did...
$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\dd}{{\rm d}}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\ic}{{\rm i}}% \newcommand{\imp}{\Longrightarrow}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert #1 \right\vert}% \newcommand{\yy}{\Longleftrightarrow}$ Assumming the integral meaning is "principal value $\pp$ of it": $$ \pp\int_{-\infty}^{\infty}{\expo{\ic ax} \over x^{2} - b^{2}}\,\dd x = \int_{-\infty}^{\infty}\expo{\ic ax}\bracks{% {1 \over x^{2} - b^{2} + \ic 0^{+}} + \ic\pi\delta\pars{x^{2} - b^{2}}}\,\dd x \tag{1} $$
\begin{align} &{1 \over x^{2} - b^{2} + \ic 0^{+}} = {1 \over \pars{x - \root{b^{2} - \ic 0^{+}}}\pars{x + \root{b^{2} - \ic 0^{+}}}} \\[3mm]&= {1 \over \bracks{x - \pars{b - \ic 0^{+}}}\bracks{x - \pars{-b + \ic 0^{+}}}} \quad \mbox{since}\ b > 0.\tag{2} \\[3mm] &\delta\pars{x^{2} - b^{2}} = {\delta\pars{x + b} + \delta\pars{x - b} \over 2b} \quad \mbox{since}\ b > 0.\tag{3} \end{align} Since $a > 0$, we choose a "${\tt\mbox{half moon}}$" contour in the upper complex half plane:
We replace $\pars{2}$ and $\pars{3}$ in expression $\pars{1}$: \begin{align} &\color{#0000ff}{\large% \pp\int_{-\infty}^{\infty}{\expo{\ic ax} \over x^{2} - b^{2}}\,\dd x} = 2\pi\ic\,{\expo{\ic a\pars{-b + \ic 0^{+}}} \over \pars{-b + \ic 0^{+}} - \pars{b - \ic 0^{+}}} + {\ic \pi \over 2b}\,\bracks{\expo{\ic a\pars{-b}} + \expo{\ic a\pars{b}}} \\[3mm]&= -\,{\pi\ic\expo{-\ic ab} \over b} + {\ic \pi \over 2b}2\cos\pars{ab} = \bracks{-\,{\pi\ic \over b}\,\cos\pars{ab} - {\pi \over b}\,\sin\pars{ab}} + {\pi\ic \over b}\,\cos\pars{ab} \\[3mm]&= \color{#0000ff}{\large -\,{\pi \over b}\,\sin\pars{ab}} \end{align}
A related problem. Here is how you advance
i) Using partial fraction gives
$$ \int_{-\infty}^{\infty}\frac{e^{iax}}{x^2 - b^2}dx = \frac{1}{2b}\,\int_{-\infty}^{\infty}{\frac {e^{iax} }{ \left( x-b \right) }}dx-\frac{1}{2b}\,\int_{-\infty}^{\infty}{\frac {e^{iax} }{ \left( x+b \right) }}dx.$$
ii) Making change of variables $x-b=t$ and $x+b=t$ in the two integrals on the RHS yields
$$ \int_{-\infty}^{\infty}\frac{e^{iax}}{x^2 - b^2}dx = \frac{e^{iab}}{2b}\,\int_{-\infty}^{\infty}{\frac {e^{iat} }{ t }}dt - \frac{e^{-iab}}{2b}\,\int_{-\infty}^{\infty}{\frac {e^{iat} }{ t }}dt=\\ \frac{i\sin(ab)}{b}\int_{-\infty}^{\infty}{\frac {e^{iat} }{ t }}dt. $$
iii) the integral
$$\int_{-\infty}^{\infty}{\frac {e^{iat} }{ t }}dt =-i\pi$$
is well known and exists in the Cauchy principal value sense. Check Fourier transform too.
iv) To evaluate the last integral using residue theorem, consider the complex integral
$$ \int_C \frac{e^{iaz}}{z}dz, $$
where $C$ is the contour (for $a>0$)