Suppose that you are trying to find all values $~x_0,~$ either real or complex, such that $~x_0~$ is a root of the following equation:
$$Ax^2 + Bx + C = 0 ~: ~A,B,C \in \Bbb{R}, ~A \neq 0. \tag1 $$
Before attacking (1) above, it is important to focus on preliminary considerations.
There is no real number $~x~$ such that $~x^2 = -1.~$ So, Mathematicians arbitrarily decided to let the symbol $~i~$ refer to the imaginary number represented by $~\displaystyle \sqrt{-1}.~$
Further, for any non-negative real number $~D,~$ you have that $~\displaystyle \left[ ~\sqrt{D} ~\right]^2 = D.~$
So, Mathematicians decided to extend this idea so that
$~\displaystyle \left[ ~\sqrt{-1} ~\right]^2 = -1.~$
This implies that $~\displaystyle i^2 = \left[ ~\sqrt{-1} ~\right]^2 = -1.$
Now, when Mathematicians refer to a complex number, they are referring to a number that has form $ ~(R + iS)~$ where $~R,S~$ are any real numbers, and $~i~$ symbolizes $~\displaystyle \sqrt{-1}.$
Then, if you have a complex number of the form $~(R + iS),~$ then :
If $~R~$ happens to equal $~0,~$ then you have the purely imaginary number $~(iS).$
If $~S~$ happens to equal $~0,~$ then you have the purely real number $~(R).$
Further, you have that
$$(-i)^2 = (-1 \times i)^2 = (-1)^2 \times \left(i^2\right)$$
$$= 1 \times \left(i^2\right) = 1 \times (-1) = -1.$$
So, you have two complex numbers, $~[ ~0 + (i \times 1)~] ~$ and $~[ ~0 + (i \times -1) ~] ~$ that each satisfy the equation $~x^2 = -1.$
This means that the equation
$$~x^2 = -1 ~$$
has the two roots $~x = \pm i.$
Furthermore, for any positive real number $~D,~$ consider the following two equations:
$x^2 = D.$
Since $~D~$ is assumed positive, the value $~\sqrt{D}~$ is defined, and is also a positive number. Then, the two roots of the equation will be given by $~x = \pm \sqrt{D}.~$
For example, if $~D = 4,~$ then the equation $~x^2 = 4~$ has the two roots $~x = \pm 2.$
$x^2 = -D.$
This is more complicated.
$\displaystyle x^2 = -D \implies x^2 = [ ~(-1) \times D~].$
One solution will be $\displaystyle ~\left[ ~i \times \sqrt{D}~\right],~$
since $\displaystyle ~\left[ ~i \times \sqrt{D}~\right]^2 = [~i^2 \times D ~] = (-1) \times D = -D.$
Then, a second solution will be
$\displaystyle ~\left[ ~(-1) \times i \times \sqrt{D} ~\right] = \left[ ~-i\sqrt{D} ~\right],$
Since $\displaystyle ~\left[ ~(-1) \times i \times \sqrt{D} ~\right]^2 = (-1)^2 \times ~\left[ ~i \times \sqrt{D} ~\right]^2 = ~\left[ ~i \times \sqrt{D} ~\right]^2 = -D.$
So, when $~D~$ is positive, the equation $~x^2 = -D~$
will have the two roots $~\displaystyle x = \pm i\sqrt{D}.$
For example, if $~D = 4,~$ then the equation $~x^2 = -4,~$
will have the two roots $~x = \pm (i \times 2).$
Now, the equation in (1) above can be attacked.
$$Ax^2 + Bx + C = 0 ~: ~A,B,C \in \Bbb{R}, ~A \neq 0 \iff $$
$$x^2 + \frac{B}{A} ~x + \frac{C}{A} = 0. \tag2 $$
Note that
$$\left( ~x + \frac{B}{2A} ~\right)^2 = x^2 + \frac{B}{A} ~x + \frac{B^2}{4A^2}.$$
This implies that equation (2) above can be re-expressed as
$$\left[ ~\left( ~x + \frac{B}{2A} ~\right)^2 - \frac{B^2}{4A^2} ~\right] + \frac{C}{A} = 0. \tag3 $$
Equation (3) above can be re-expressed as
$$\left( ~x + \frac{B}{2A} ~\right)^2 - \frac{B^2 - 4AC}{4A^2} = 0. \tag4 $$
What this signifies is that any value of $~x,~$ real or complex, will satisfy equation (1) above if and only if it satisfies equation (4) above.
Equation (4) above may be re-expressed as
$$\left( ~x + \frac{B}{2A} ~\right)^2 = \frac{B^2 - 4AC}{4A^2}.$$
Now, let $~D~$ denote $~\displaystyle \frac{B^2 - 4AC}{4A^2}.~$
Either $~D = 0~$ or $~D > 0,~$ or $~D < 0.$
If $~D = 0,~$ then you have the equation
$$\left( ~x + \frac{B}{2A} ~\right)^2 = 0. \tag5 $$
This equation will only have one root, namely
$$\left( ~x + \frac{B}{2A} ~\right) = 0 \iff x = \frac{-B}{2A}.$$
If $~D > 0,~$ then you have the equation
$$\left( ~x + \frac{B}{2A} ~\right)^2 = D. \tag6 $$
From the preliminary discussion, this equation will have the two roots:
$$\left( ~x + \frac{B}{2A} ~\right) = \pm \sqrt{D} \iff x = \frac{-B}{2A} \pm \sqrt{D}. \tag7 $$
If $~D < 0,~$ then let $~E~$ denote $~|D|.~$
This implies that $~E > 0,~$ and that $~D = -E.~$
Then you have the equation
$$\left( ~x + \frac{B}{2A} ~\right)^2 = -E. \tag8 $$
From the preliminary discussion, this equation will have the two roots:
$$\left( ~x + \frac{B}{2A} ~\right) = \pm i\sqrt{E} \iff x = \frac{-B}{2A} \pm i\sqrt{E}. \tag9 $$