How did Euler derive these complex factors I am just reading the first chapter of the Introduction to Analysis of the Infinite and get stuck here:

How did he derive $z^2-2(p+qi)z+r+si$ and $z^2-2(p-qi)z+r-si$ for the function $z^4+Az^3+Bz^2+Cz+D$
What about the four complex linear factors? How did he derive it?
Thank you!
 A: To derive the two complex quadratic factors, consider the product of two linear complex factors like
$$
(z - (k+li))(z - (m+ni)) \\
= z^2 - ((k+li)+(m+ni))z + (k+li)(m+ni) \\
= z^2 - ((k+m)+(l+n)i)z + ((km-ln) + (kn+lm)i)
$$
If you let $p=k+m$, $q=l+n$, $r=km-ln$ and $s=kn+lm$ we then have
$$
z^2 - (p+qi)z + r + si
$$
This explains the negative coefficient of the first-degree term which is further explained if you consider that the sum of the roots should equal $p+qi$ and the product should equal $r+si$. Using the quadratic formula, let's convince ourselves of the sum with
$$
\left(\frac{p+qi+\sqrt{(p+qi)^2-4(r+si)}}{2}\right) +
\left(\frac{p+qi-\sqrt{(p+qi)^2-4(r+si)}}{2}\right) \\
= \frac{(p+qi)+(p+qi)}{2} \\
= p+qi
$$
The presence of a denominator in the quadratic formula makes the calculation awkward, so it can be removed by multipling numerator and therefore the first-degree coefficient by $2$
$$
\frac{2(p+qi)\pm\sqrt{[2(p+qi)]^2-4(r+si)}}{2} \\
= (p+qi)\pm\sqrt{(p+qi)^2-(r+si)} \\
= (p+qi)\pm\sqrt{p^2+2pqi-q^2-r-si}
$$
This, combined with the previous explanation, explains the $-2$ coefficient of the first-degree term which also happens to explain the first two of the four complex linear factors. The last two can be explained if I had started this answer with the product of two linear complex factors like
$$
(z-(k-li))(z-(m-ni))
$$
A: The two quadratic factors are what it takes to get a quartic polynomial. As their product must be real, the coefficients need to be complex conjugates (check it for yourself). Both the quartic and quadratics polynomials have four independent coefficients.
You can obtain this result by expanding
$$(x^2+ax+b)(x^2+cx+b)$$ where $a,b,c,d$ are complex, and ensuring real coefficients.
The linear factors are simply obtained from the roots of the two announced quadratic factors, written
$$z^2-2(p\pm qi)+r\pm si.$$
