What's the name/purpose of this process, precisely?

I'm reading John D'Angelo's Mathemathical Thinking: Problem-Solving and Proofs:

First we rewrite the equation in a manner where the unknown value $x$ appears only once:

$$\begin{eqnarray*} {0=a(x^2+\frac{b}{a}x)+c}&=&{a(x^2+\frac{b}{a}x +\color{red}{\frac{b^2}{4a^2}})-\color{red}{\frac{b^2}{4a}}+c} \\ {}&=&{a(x+ \frac{b}{2a})^2+c-\frac{b^2}{4a}} \end{eqnarray*}$$

Can someone explain me what is happening in the red fractions? I've seen it sometimes, it's not clear why this trick is employed - I'm aware that it's used to let equations and formulas more convenient for some purposes, such as in this case in which the objective is to rewrite the equation in a manner where the unknown value $x$ appears only once.

I've also discovered that performing the adequate operations on them, they'll vanish:

$$\frac{ab^2}{4a^2}-\frac{b^2}{4a}=0$$

But for the rest, I am confused.

To make $$a\left(x+\frac{b}{2a}\right)^2.$$
You'll see $$a\left(x^2+\frac bax+\frac{b^2}{4a^2}\right)=a\left(x+\frac{b}{2a}\right)^2.$$
You may need to understand the following : If you have $x^2+Ax,$ you need to add $$\left(\frac A2\right)^2$$ to make $()^2$. So, $$x^2+Ax=x^2+Ax+\left(\frac A2\right)^2-\left(\frac A2\right)^2=\left(x+\frac A2\right)^2-\left(\frac A2\right)^2.$$