You start by knowing what "continuous" means! If f is "continuous" then it is continuous at all x and, in particular at x= -1. In order that f be continuous at x= -1, the limit, as x goes to -1 must be f(-1)= -3.
But for x anything other than -1, f(x) is a fraction with (x+ 1)^2 in the denominator. In order that the limit exist, the numerator must also contain a factor of (x+ 1)^2 to cancel that. The numerator is cubic so it must be of the form (x+ 1)^2(px+ q)= (x^2+ 2x+ 1)(px+ q)= px^3+ qx^2+ 2px^2+ 2qx+ px+ q= px^3+ (q+ 2p)x^2+ (2q+ p)x+ q
That must be equal to x^3+ ax^2+ bx+ c so p= 1 and we then have a=q+ 2, b= 2q+ 1, and c= q.
Of course, canceling the (x+ 1)^2 leaves px+ q= x+ q and the limit of that, as x goes to -1 is -1+ q= 3 so q= 4.