Evaluating Complex Integral. I am trying to evaluate the following integrals:
$$\int\limits_{-\infty}^\infty \frac{x^2}{1+x^2+x^4}dx $$
$$\int\limits_{0}^\pi \frac{d\theta}{a\cos\theta+ b} \text{ where }0<a<b$$
My very limited text has the following substitution:
$$\int\limits_0^\infty \frac{\sin x}{x}dx = \frac{1}{2i}\int\limits_{\delta}^R \frac{e^{ix}-e^{-ix}}{x}dx \cdots $$
Is the same of substitution available for the polynomial? Thanks for any help. I apologize in advance for slow responses, I have a disability that limits me to an on-screen keyboard.

$f(z) := \frac{1}{a\cos z+b}$
Let $I$ be the integral in question.  Let's double the integral, to get
$$2I =\int_0^{2\pi} f(z)\, dz$$
Let $C$ be the contour of the unit circle $|z|=1$ in the positive direction.  Then using this, we have
$$2I = \oint_C \frac{1}{a\left(\frac{z+z^{-1}}{2}\right)+b}\frac{dz}{iz} = -2 i \oint_C \frac{dz}{az^2+2bz+a}$$
The last integral can be evaluated by residues.  The poles of the function are at 
$$b_\pm = \frac{-b\pm \sqrt{b^2-a^2}}{a}$$
Based on $b>a>0$, we find the only pole in the contour $C$ is $b_+$.  The residue there is:
$$z_+ = \operatorname*{Res}_{z=b_+}\frac{1}{az^2+2bz+a} = \frac{1}{2\sqrt{b^2-a^2}}$$
Then
$$2I = -2 i \left(\frac{2 \pi i}{2\sqrt{b^2-a^2}}\right) = \frac{2\pi}{\sqrt{b^2-a^2}}$$
Divide by $2$ and done.

$$f(z) := \frac{z^2}{1+z^2+z^4} = \frac{z^2}{(z^2-z+1)(z^2+z+1)}$$
Poles of $f$ occur at, using the quadratic formula:
$$b_{1} = \frac{1+\sqrt 3i}{2}$$
$$b_{2} = \frac{-1+\sqrt 3i}{2}$$
$$b_{3} = \frac{1-\sqrt 3i}{2}$$
$$b_{4} = \frac{-1-\sqrt 3i}{2}$$
Using the canonical semicircle contour ($Re^{i\theta}$ for $\theta \in [0,\pi]$) over the upper half plane, it is easily seen that the integral of $f(z)$ over the arc disappears as $R \to \infty$.  Then we only need to find the residues of $b_1$ and $b_2$ (using the first or second formula here):
$$z_1 = \operatorname*{Res}_{z=b_1}f(z)= -\frac{1}{4}-\frac{i}{4\sqrt 3}$$
$$z_2 = \operatorname*{Res}_{z=b_2}f(z)= \frac{1}{4}-\frac{i}{4\sqrt 3}$$
$$\oint_C f(z)\, dz = \int_{-\infty}^\infty f(x)\, dx = 2 \pi i (z_1+z_2) =-2 \pi  i \frac{i}{2\sqrt 3} = \frac{\pi}{\sqrt 3}$$
