If the numerator $P(x)$ has at least as many powers of $x$ as the denominator $Q(x)$, then the rational function $\displaystyle\frac{P(x)}{Q(x)}$ is called improper. In this case, we use long division to write the ratio as a polynomial with a remainder.
If dividing $P(x)$ by $Q(x)$ gives $S(x)$ with remainder $R(x)$, then
$$\frac{P(x)}{Q(x)} = S(x) + \frac{R(x)}{Q(x)}$$
Integrating $S(x)$ is easy, since it's a polynomial, and we can use partial fractions on $\displaystyle\frac{R(x)}{Q(x)}$.