A hard integral, can't seem to prove it How to show that,
$$\int_{-\infty}^{+\infty}\frac{(x-1)^2}{(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2}\mathrm dx=\pi$$
Let assume $a\ge1$
I have tried substitution but it leads to a more complicated integral.
 A: Noting that
\begin{eqnarray}
&&(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2\\
&=&\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}+(2x-1)i\right)\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}-(2x-1)i\right) \\
&=&\left(ax^2+(2i-1)x-\frac{(a-1)^2}{2(2a-1)}-i\right)\left(ax^2-(2i+1)x-\frac{(a-1)^2}{2(2a-1)}+i\right) 
\end{eqnarray}
so the equation
$$(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2=0$$
has two roots in the upper half plane
$$ x_1=\frac{(1+2 i)-\sqrt{\frac{2 a^3-(4+8 i) a^2-(4-12 i) a+(3-4 i)}{2
   a-1}}}{2 a},x_2=\frac{(1+2 i)+\sqrt{\frac{2 a^3-(4+8 i) a^2-(4-12 i) a+(3-4 i)}{2
   a-1}}}{2 a}.$$
Thus after long calculation, one has
\begin{eqnarray}
&&\int_{-\infty}^{+\infty}\frac{(x-1)^2}{(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2}\mathrm dx\\
&=&2\pi i\bigg[\text{Res}_{x=x_1}\bigg(\frac{(x-1)^2}{(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2}\bigg)\\
&&+\text{Res}_{x=x_2}\bigg(\frac{(x-1)^2}{(2x-1)^2+\left(ax^2-x-\frac{(a-1)^2}{2(2a-1)}\right)^2}\bigg)\bigg]\\
&=&2\pi i\bigg[\frac{(x_1^2-1)^2}{4(2x_1-1)+2\left(ax_1^2-x_1-\frac{(a-1)^2}{2(2a-1)}\right)(2ax_1-1)}\\
&&+\frac{(x_2^2-1)^2}{4(2x_2-1)+2\left(ax_2^2-x_2-\frac{(a-1)^2}{2(2a-1)}\right)(2ax_2-1)}\bigg]\\
&=&2\pi i(-\frac{i}{2})\\
&=&\pi.
\end{eqnarray}
