Factorizing $z^2-z\frac{a^2 +b^2}{ab}+1 = (z-a/b)(z-b/a)$ The intermediate factorization calculation $z^2-z\frac{a^2 +b^2}{ab}+1 = (z-a/b)(z-b/a)$ was coined straightforward by Riley's Mathematical Methods for Physics and Engeneering (eq.24.66).

I've tried completing the square,

$$
z^2-z\frac{a^2 +b^2}{ab}+1 = 0 \\
 \bigg( z-\frac{a^2 +b^2}{2ab} \bigg)^2 +1 -\frac{(a^2+b^2)^2}{(2ab)^2} = 0 \\
\bigg( z-\frac{a^2 +b^2}{2ab} \bigg)^2 = \frac{(a^2+b^2)^2}{(2ab)^2}-1  \\
z= \frac{a^2 +b^2}{2ab}  \pm \sqrt{\frac{(a^2+b^2)^2}{(2ab)^2}-1} \ ,  \\
$$
which doesn't nearly suggest the simple end result.

I'm sure it will roll out after reorganizing terms, but I'm interested in an alternative approach which more naturally suggests the end result of $(z-a/b)(z-b/a)$, reflecting the word-use of straightforward in the text.

Context.

Using contour integration to evaluate $I = \int_{0}^{2\pi} \frac{\cos(2\theta)}{a^2+b^2-2ab\cos(\theta)}d\theta$
Indeed, one can see that

$$\frac{a}{b} + \frac{b}{a} = \frac{a^2 + b^2}{ab}$$

Going from the RHS to the LHS is called fraction decomposition.

Your result should be clearer now:

$$z^2 - z\left(\frac{a^2 + b^2}{ab}\right) + 1 = z^2 - z\frac{a}{b} - z\frac{b}{a} + 1 = \left(z - \frac{a}{b}\right)\left(z - \frac{b}{a}\right)$$
it must be $$z_{1,2}=\frac{a^2+b^2}{2ab}\pm\sqrt{\left(\frac{a^2+b^2}{2ab}\right)^2-1}$$
and we can factorize to $$-\frac{(a-bz)(az-b)}{ab}$$ and $$ab\ne 0$$