The part in the middle is -z(z + 3) becomes -z² - 3z .
Those two negative things cancel the two positive things in the expression . . .
well, here, let me show you :
z² - z(z + 3) + 3z = z² [ - z² - 3z ] + 3z . . . and that all adds up to exactly zero.