The vertical asymptote comes from the denominator. So denominator cannot be zero, vertical asymptote is obtain when we let the denominator to be zero. In this case,

x - 2 = 0

x = 2.

We can get the horizontal asymptote (or diagonal asymptote) when we make the fraction into proper fraction.

y = 2 + [5/(x-2)]

Ignoring the proper fraction, we have y = 2.

Another example,

y = 3x+1 + [x/(x-1)(x+2)]

Vertical asymptote are x = 1 and x = -2.

Diagonal asymptote (horizontal asymptote) is y = 3x+1

The reason behind the diagonal asymptote is that as x tends to negative or positive infinity, the proper fraction will tends to zero as the denominator gets larger and larger. Thus y will tends to the 3x + 1 in this case.