Divide by x−5 first: corner 5, top row 1,−7,7,15 gives bottom row 1,−2,−3 with remainder 0, so P(x)=(x−5)(x2−2x−3).
x2−2x−3=(x−3)(x+1)
The second exact division confirms the factor x−3 and leaves x+1. Altogether P(x)=(x−5)(x−3)(x+1); expanding restores x3−7x2+7x+15, since (x−5)(x−3)=x2−8x+15 and multiplying by x+1 gives the original cubic.