Improper integral $\int_0^\infty\frac{x^{2n+1}}{(1+x^2)^2(2+x^2)^N}dx,\ \ \ n\le N$ How can I evaluate this integral?
$$\int_0^\infty\frac{x^{2n+1}}{(1+x^2)^2(2+x^2)^N}dx,\ \ \ n\le N$$
Maybe there is a recurrence relation for the integral?

Let us renumber $N=n+L$ and let $K_{n,L} = I_{n,n+L} = \frac{1}{2} \int_0^\infty \frac{y^n}{(1+y)^2 (2+y)^{n+L}} \, dy$, which is the desired integral after the variable change $y=x^2$. Let $K(s,t) = \sum_{L=0}^\infty \sum_{n=0}^\infty K_{n,L} s^L t^n$. For small enough $s$ and $t$, the integrands converge uniformly over the interval of integration, so we can exchange the summation with the integration to get
\begin{align*}
  K(s,t) &= \frac{1}{2} \int_0^\infty \frac{(2+y)^2}{(1+y)^2 (2-s+y) (2+(1-t)y)} \, dy \\
  &= \frac{1}{2\pi i} \frac{1}{2} \oint_\gamma \frac{\log(-y) (2+y)^2}{(1+y)^2 (2-s+y) (2+(1-t)y)} \, dy,
\end{align*}
where the complex contour $\gamma$ tightly encircles the positive real line clockwise. Deforming the contour to counter-clockwise encircle the poles at $y=-1,-2+s,-2/(1-t)$, we get
\begin{align*}
  K(s,t) &= \sum_{z=-1,-2+s,-\frac{2}{(1-t)}} \operatorname{Res}_{y=z}
    \frac{1}{2} \frac{\log(-y) (2+y)^2}{(1+y)^2 (2-s+y) (2+(1-t)y)} \\
  &= \frac{1}{2} \frac{1}{(1-s)(1+t)}
    + \frac{1}{2} \frac{s^2 \log(2-s)}{(1-s)^2 (s+2t-st)}
    - \frac{1}{2} \frac{4t^2 \log(\frac{2}{1-t})}{(1+t)^2 (s+2t-st)} \\
  &= \frac{1}{2} \frac{1}{(1-s)(1+t)}
\\ & \quad {}
    + \frac{1}{2(1-t)(s+\frac{2t}{1-t})} \left( \frac{s^2 \log(2-s)}{(1-s)^2}
      - \frac{(\frac{2t}{1-t})^2 \log(2+\frac{2t}{1-t})}{(1+\frac{2t}{1-t})^2} \right) .
\end{align*}
Note that the last term is of the form $(f(x)-f(y))/(x-y)$ for $x=s$ and $y=-\frac{2t}{1-t}$, so that this ratio is expressible as some $g(x,y)$ that is analytic at $x=y$, which tells you how an expansion in $s$ and $t$ is possible despite the pesky factor of $1/(s+\frac{2t}{1-t})$.
This answer is the same as Neil Strickland's. But he didn't specify how to do the expansion in the presence of the pesky denominator mentioned above.
