It is always produces the answers to a quadratic, unless it isn't factorable.
It produces the correct roots for
any quadratic, whether the quadratic is factorable or not and whether or not the roots are real or not.
If you know how the formula is derived, the above statements become obvious.
\(\displaystyle Let\ a,\ b,\ and\ c \in \mathbb C\,\ a \ne 0,\ and\ ax^2 + bx + c = 0.\)
\(\displaystyle So\ \dfrac{ax^2}{a} + \dfrac{bx}{a} + \dfrac{c}{a} = \dfrac{0}{a}.\) Divide by a.
\(\displaystyle x^2 + \left(\dfrac{2}{2} * \dfrac{bx}{a}\right) + \left(\dfrac{4a}{4a} * \dfrac{c}{a}\right) = 0.\) Nothing weird here.
\(\displaystyle x^2 + 2\left(\dfrac{b}{2a}\right) + \dfrac{4ac}{4a^2} = 0 \implies x^2 + 2\left(\dfrac{b}{2a}\right) = - \dfrac{4ac}{4a^2}.\) Just algebra.
\(\displaystyle x^2 + 2\left(\dfrac{b}{2a}\right) + \dfrac{b^2}{4a^2}= \dfrac{b^2}{4a^2} - \dfrac{4ac}{4a^2}.\) More algebra.
\(\displaystyle x^2 + 2\left(\dfrac{b}{2a}\right) + \left(\dfrac{b}{2a}\right)^2 = \dfrac{b^2 - 4ac}{4a^2}.\) And more.
\(\displaystyle \left(x + \dfrac{b}{2a}\right)^2 = \dfrac{b^2 - 4ac}{4a^2}.\) And more
\(\displaystyle x + \dfrac{b}{2a} = \pm \sqrt{\dfrac{b^2 - 4ac}{4a^2}} = \pm \dfrac{\sqrt{b^2 - 4ac}}{\sqrt{4a^2}} = \pm \dfrac{\sqrt{b^2 - 4ac}}{2a} \implies\)
\(\displaystyle x = -\dfrac{b}{2a} \pm \dfrac{\sqrt{b^2 - 4ac}}{2a} = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}.\)
Nothing about factoring or real numbers in the derivation.