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.

For the first one, write $\dfrac{x^2}{1+x^2+x^4}$ as $\dfrac{x}{2(1-x+x^2)} - \dfrac{x}{2(1+x+x^2)}$. Now
$$\dfrac{x}{(1-x+x^2)} = \dfrac{x-1/2}{\left(x-\dfrac12\right)^2 + \left(\dfrac{\sqrt3}2 \right)^2} + \dfrac{1/2}{\left(x-\dfrac12\right)^2 + \left(\dfrac{\sqrt3}2 \right)^2}$$
and
$$\dfrac{x}{(1-x+x^2)} = \dfrac{x+1/2}{\left(x+\dfrac12\right)^2 + \left(\dfrac{\sqrt3}2 \right)^2} - \dfrac{1/2}{\left(x+\dfrac12\right)^2 + \left(\dfrac{\sqrt3}2 \right)^2}$$
I trust you can take it from here.

For the second one, from Taylor series of $\dfrac1{(b+ax)}$, we have
$$\dfrac1{(b+a \cos(t))} = \sum_{k=0}^{\infty} \dfrac{(-a)^k}{b^{k+1}} \cos^{k}(t)$$
Now $$\int_0^{\pi} \cos^k(t) dt = 0 \text{ if $k$ is odd}$$
We also have that
$$\color{red}{\int_0^{\pi}\cos^{2k}(t) dt = \dfrac{(2k-1)!!}{(2k)!!} \times \pi = \pi \dfrac{\dbinom{2k}k}{4^k}}$$
Hence,
$$I=\int_0^{\pi}\dfrac{dt}{(b+a \cos(t))} = \sum_{k=0}^{\infty} \dfrac{a^{2k}}{b^{2k+1}} \int_0^{\pi}\cos^{2k}(t) dt = \dfrac{\pi}{b} \sum_{k=0}^{\infty}\left(\dfrac{a}{2b}\right)^{2k} \dbinom{2k}k$$
Now from Taylor series, we have
$$\color{blue}{\sum_{k=0}^{\infty} x^{2k} \dbinom{2k}k = (1-4x^2)^{-1/2}}$$
Hence,
$$\color{green}{I = \dfrac{\pi}{b} \cdot \left(1-\left(\dfrac{a}b\right)^2 \right)^{-1/2} = \dfrac{\pi}{\sqrt{b^2-a^2}}}$$
