I have the function:
$$F(s) = \frac{s^4+3s^3+2s^2+4s+4}{(s+3)(s^2+1)}$$
and I have to make inverse Laplace. I tried to collect $s^3$ from the first and second element of the numerator in order to obtain:
$$\frac{2s^2+4s+4}{(s+3)(s^2+1)} + \frac{s^3}{s^2+1}$$
for the first, I calculated residues and for the second, I made a polynomial division. I obtained
$$\frac{1}{s+3} + \frac{1}{s^2+1} + s - \frac{s}{s^2+1}$$
When I calculated the inverse I obtained: $$e^{-3t}H(t) + \sin(t)H(t) + \delta_0' - \cos(t)H(t)$$
But, in the solution there isn't $\cos(t)H(t)$
Because you have a mistake when computing the Residues, you should get $$F(s) = \frac{s^4+3s^3+2s^2+4s+4}{(s+3)(s^2+1)} = \frac{1}{s+3} + \frac{1}{s^2+1} + s \tag{1} $$ which answers your question on why you have an extra $\cos(t)H(t)$ appearing. To see why you have done a calculation mistake, take a look here: $$\frac{1}{s+3} + \frac{1}{s^2+1} + s = \frac{s^2+1+s+3+s(s+3)(s^2+1)}{(s+3)(s^2+1)}$$ which upon arranging terms you get equation $(1)$.