Divergent Integral
Note that
$$
\frac{\cos(2\pi x)}{x^2-1}=\frac{\cos(2\pi x)}2\left(\frac1{x-1}-\frac1{x+1}\right)
$$
The integral diverges at $x=-1$ and $x=1$, but we can compute the Cauchy Principal Value, which involves removing a small interval centered around each singularity.
Cauchy Principal Value
The reason that centering is important is that if the singularity is of the first order, then we have a situation similar to
$$
\int_{-1}^{-r}\frac1x\,\mathrm{d}x+\int_r^1\frac1x\,\mathrm{d}x=0
$$
where the effect of the singularity is cancelled around an interval centered on $0$ since $\frac1x$ is an odd function.
An easy way to approach the evaluation of the Cauchy Principal Value is using contour integration. Consider the integral of $\frac1z$ along the contour $\color{#0000FF}{[-1,-r]}\cup\color{#C000FF}{re^{i[\pi,0]}}\cup\color{#0000FF}{[r,1]}$:
$$
\begin{align}
&\int_{-1}^{-r}\frac1z\,\mathrm{d}z+\int_{\pi}^0\overbrace{\frac1{re^{i\theta}}}^{1/z}\,\overbrace{\vphantom{\frac1z}ire^{i\theta}\mathrm{d}\theta}^{\mathrm{d}z}+\int_r^1\frac1z\,\mathrm{d}z\\
&=\log(r)+\int_\pi^0i\,\mathrm{d}\theta-\log(r)\\
&=-\pi i
\end{align}
$$
which is $-\pi i$ times the residue of $\frac1z$ at $0$ since the contour takes $\frac12$ turn clockwise around $0$.
Thus, we can compute the Cauchy Principal Value by computing a contour integral and subtracting the contributions of semicircles around the singularities, which will be $\pi i$ times the residues of those singularities.
There are at least two ways to evaluate the Cauchy Principal Value for this problem.
Contour Integration
Using the counter-clockwise contour, which contains no singularities,
$$
\small\color{#00A000}{\gamma}=\color{#0000FF}{[-R,-1-r]}\cup\overbrace{\color{#C000FF}{re^{i[\pi,0]}-1}}^{\begin{array}{c}\text{$\frac12$ turn clockwise}\\\text{about $-1$}\end{array}}\cup\color{#0000FF}{[-1+r,1-r]}\cup\overbrace{\color{#C000FF}{re^{i[\pi,0]}+1}}^{\begin{array}{c}\text{$\frac12$ turn clockwise}\\\text{about $+1$}\end{array}}\cup\color{#0000FF}{[1+r,R]}\cup\overbrace{\color{#C00000}{Re^{i[0,\pi]}}}^{\text{vanishes}}
$$
as $R\to\infty$ and $r\to0$, we get that
$$
\begin{align}
\small\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}{x^2-1}\,\mathrm{d}x
&\,\small=\mathrm{Re}\!\left(\color{#0000FF}{\int_{-R}^{-1-r}\frac{e^{2\pi ix}}{x^2-1}\,\mathrm{d}x}
+\color{#0000FF}{\int_{-1+r}^{1-r}\frac{e^{2\pi ix}}{x^2-1}\,\mathrm{d}x}
+\color{#0000FF}{\int_{1+r}^R\frac{e^{2\pi ix}}{x^2-1}\,\mathrm{d}x}\right)\\
&\small=\mathrm{Re}\!\left(\color{#00A000}{\int_\gamma\frac{e^{2\pi iz}}{z^2-1}\,\mathrm{d}z}
+\color{#C000FF}{\pi i\operatorname*{Res}_{z=-1}\left(\frac{e^{2\pi iz}}{z^2-1}\right)}
+\color{#C000FF}{\pi i\operatorname*{Res}_{z=1}\left(\frac{e^{2\pi iz}}{z^2-1}\right)}\right)\\
&\small=\mathrm{Re}\!\left(\color{#00A000}{0}\,-\,\color{#C000FF}{\frac{\pi i}4}\,+\,\color{#C000FF}{\frac{\pi i}4}\right)\\[4pt]
&\small=0
\end{align}
$$
Exploitation of Periodicity
$$
\begin{align}
\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}{x^2-1}\,\mathrm{d}x
&=\frac12\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}{x-1}\,\mathrm{d}x
-\frac12\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}{x+1}\,\mathrm{d}x\\
&=\frac12\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}x\,\mathrm{d}x
-\frac12\mathrm{PV}\int_{-\infty}^\infty\frac{\cos(2\pi x)}x\,\mathrm{d}x\\[6pt]
&=0
\end{align}
$$
HINTS:
On the "upper" part of the branch cut, $z^a=x^a$, while on the lower part, $z^a=x^a\,e^{i2\pi a}$.
Hence, you will obtain
$$(1-e^{i2\pi a})\int_0^\infty \frac{x^a}{x^2+3x+2}\,dx=2\pi i \times \text{Sum of the Residues}$$
Now, check.your calculation of the residues. On the negative real axis $z^a=|x|^a e^{i\pi a}$
Best Answer
Let $I$ be the contour integral
$$I=\oint_{|z|=4} \frac{z^3}{e^{z^2}-1}\,dz$$
There are four simple poles at $z=\pm e^{i\pi/4}\sqrt{2\pi}$ and $z=\pm e^{\ i \pi/4}\sqrt{4\pi}$ contained in $|z|<4$. We can find the residues using L'Hospital's Rule. Proceeding we find that the residues are in general
$$\begin{align} \text{Res}\left(\frac{z^3}{e^{z^2}-1}, z=\pm e^{ \pi/4 }\sqrt{2n\pi}\right)&=\lim_{z\to \pm e^{ i\pi/4}\sqrt{2n\pi}}\frac{(z-e^{\pm \pi/4 }\sqrt{2n\pi})z^3}{e^{z^2}-1}\\\\ &=\lim_{z\to \pm e^{\ i\pi/4}\sqrt{2n\pi}}\frac{3z^2(z-e^{\pm \pi/4 }\sqrt{2n\pi})+z^3}{2ze^{z^2}}\\\\ &=in\pi \end{align}$$
Hence, we find that
$$I=2\pi i (i\pi+i\pi+i2\pi+i2\pi)=-12\pi^2$$
See THIS ANSWER for a detailed explanation of integration around a dog bone contour.
Let $J$ be the real integral given by
$$J=\int_0^2 \frac{\sqrt{x(2-x)}}{x+3}\,dx$$
We can evaluate $J$ be analyzing the contour integral $K$ as given by
$$K=\oint_{C_{DB}}\frac{\sqrt{z(2-z)}}{z+3}\,dz$$
where $C_{DB}$ is the classical dog bone contour around the branch cut from $z=0$ to $z=2$. We can evaluate $K$ by deforming the contour and evaluating the residues at $z=-3$ and at infinity. Proceeding, we have
$$\text{Res}\left(\frac{\sqrt{z(2-z)}}{z+3}, z=-3\right)=i\sqrt{15}$$
$$\text{Res}\left(\frac{\sqrt{z(2-z)}}{z+3}, z=\infty\right)=i4$$
Therefore, we find that
$$K=8\pi-2\sqrt{15}\pi$$
Dividing by $2$ reveals that
$$J=(4-\sqrt{15})\pi$$