$b<a$ or the integral will not converge.
If you don't want to use complex analysis, Try the substitution:
$t = \tan \frac {x}{2}\\
x = 2\arctan t\\
dx = \frac {2}{1+t^2}\ dt\\
\sin x = \frac {2t}{1+t^2}\\
\cos x = \frac {1-t^2}{1+t^2}$
Due to the discontinutity of the $\tan$ function, this will work better if we integrate from $-\pi$ to $\pi.$ And since this is a still a full period for the integrand that is okay.
The limits of integration will be $(-\infty, infty)
$\int_{-\infty}^{\infty} \frac {8t^2}{(t^2+1)^2(a(1+t^2) + b(1-t^2))}\ dt\\
\int_{-\infty}^{\infty} \frac {8t^2}{(t^2+1)^2( (a+b) + (b-a)t^2)}\ dt$
Which looks like it is asking for a partial fraction decomposition.
$\frac {At + B}{(t^2 + 1)} + \frac {Ct + D}{(t^2 + 1)^2} + \frac {Et+F}{(a+b)t^2 + (b-a)}$
I get:
$\frac {2(b-a)}{a^2} \frac {1}{(t^2 + 1)} + \frac {4}{a} \frac {1}{(t^2 + 1)^2} + \frac {2(b^2-a^2)}{a^2} \frac {1}{(a+b)t^2 + (b-a)}$
$\frac {2(b-a)}{a^2} \arctan {t} + \frac {2}{a} (\frac {t}{1+t^2} + \arctan t) + \frac {2\sqrt {b^2-a^2}}{a^2}\arctan \sqrt {\frac {b-a}{a+b}} t$
$(\frac {(b-a)}{a^2} + \frac {1}{a}+ \frac {\sqrt {b^2-a^2}}{a^2}) 2\pi$
And double check my algebra, because I could well have dropped something along the way.