Every rational function $\dfrac{P(x)}{Q(x)}$ (quotient of polynomials with real coefficients) may be decomposed into a sum of a polynomial and multiples of partial fractions of the type

Therefore integration of rational functions is always solvable, as long as we know how to integrate the previous functions. The first type is immediate:

For the second type, after changes of variable and manipulations, we are left with fractions of the form

The change of variable $t=x^2+1$ is well-suited for the second case

As for the first case, the implicit change of variable $\tan t=x$ turns everything into powers of cosines