There are a number of ways to do these...long division is one and let any remainder equal 0. This can get messy though.
Preferably - if you are given a quadratic factor of a cubic, then you know that the other factor is in the form (ax+k) where k is some unknown.
Multiply the quadratic by the (ax+k), multiply it all out and then let the whole thing equal the cubic. Equate the x^2 terms on the LHS with the x^2 on the RHS, the x terms on the LHS with the x terms on the RHS and finally any terms independent of x on the LHS with any independent of x on the RHS. Posting an example but will pop the full solution below in a bit also...give you a chance to have a go first!