It's not magic. You just have to look.

x² - 8x + 15 =

Obvious part:

(x __ ___)(x __ ___)

Factors of 15

1,15

3,5

That's it.

Can one get 8 from these factors?

1+15 = 16 -- Nope.

1-14 = -14 -- Nope

3-5 = -2 -- Nope

3+5 = 8 -- Yes!!

(x __ 3)(x __ 5)

15 > 0, so 3 and 5 need the same sign.

-8 < 0, so both must be negative.

x² - 8x + 15 = (x - 3)(x - 5)

You do the other one.