This is the process of completing the square.
Keep this equation in mind:

Basically, to make this a perfect square trinomial, you take half of b and square that value. This will make it so you can compress the left side of the equation into

depending on the sign in the middle of the original equation.