First simplify the rational expression by dividing. The degree in the numerator has to be at least 1 less than the degree in the denominator before you can decompose into partial fractions.
(3x³ - 5x² - 3x - 40) / ((x² + 4) (x - 3)) = 3 + (4x² - 15x - 4) / ((x² + 4) (x - 3))
Now decompose the remainder term into partial fractions:
(4x² - 15x - 4) / ((x² + 4) (x - 3)) = (ax + b) / (x² + 4) + c / (x - 3)
Multiply both sides by the denominator on the left:
4x² - 15x - 4 = (ax + b) (x - 3) + c (x² + 4)
Expand the right side:
4x² - 15x - 4 = ax² + (b - 3a) x - 3b + cx² + 4c
4x² - 15x - 4 = (a + c) x² + (b - 3a) x - 3b + 4c
Then
a + c = 4
b - 3a = -15
-3b + 4c = -4
Solve this system to get
a = 5, b = 0, c = -1
We end up with
(4x² - 15x - 4) / ((x² + 4) (x - 3)) = 5x / (x² + 4) - 1 / (x - 3)
and so
(3x³ - 5x² - 3x - 40) / ((x² + 4) (x - 3))
= 3 + 5x / (x² + 4) - 1 / (x - 3)