Notice that #5 = 2+3# and #6 = 2*3#, so
#(n - 2)(n - 3) = (n*n)-(2*n)-(3*n)+(2*3)#
#= n^2-(2+3)n+(2*3)#
#= n^2-5n+6#
In general #(x + a)(x + b) = x^2 + (a+b)x + ab# so if you can spot two numbers #a# and #b# such that their sum is the coefficient of #x# and their product is the constant term then you can quickly factorise such a quadratic formula.