We want two numbers that add to #-17# and multiply to #-18#. When you're trying to figure these numbers out, it's easier to think about the numbers that have to multiply, since there are fewer integers hat multiply to #-18# than add to #-17#.
You should come up with #-18# and #1#.
So #x^2-17x-18=(x-18)(x+1)=0#.
If you don't believe me, multiply #(x-18)(x+1)# out and you will get #x^2-17x-18#. Even if you do believe me, you should do it anyway to understand why we need to find two numbers that multiply and add the way they do.
Once we have #x^2-17x-18=(x-18)(x+1)=0#, it's easy. For two numbers to multiply to #0#, one of the numbers must be #0#. So #x-18=0# or #x+1=0#.
So #x=-18# or #x=-1#.