integrating using partial fractions

You know how the numerator must be a lower degree than the denominator and if it isn't then you need to use long division/synthetic division? That's were I'm stuck. For example $\displaystyle \int\frac{x^3+4}{x^2+4}dx$ I tried doing long division but then I got a remainder and I'm not really sure what I'm doing.

Also it kind of confuses me when it's not just one constant on the top (e.g. A/(x-9)) how does this work? For example, if one of the factors in the numerator is $\displaystyle (x-9)^3$ then would I have $\displaystyle \frac{Ax^2+Bx+C}{(x-9)^3}$?