So, for x's close to plus or minus infinity, g(x) behaves more or less like the quotient of the highest terms of the numerator and the denominator:
There are three possibilities: n=m, n<m, and n>m. The quotient (after canceling x's) looks in each of the three cases as follows:
In the first case, y=an/bn is an asymptote. Of course, g(x) is very close, closer and closer, to the finite number an/bn as x approaches plus or minus infinity. In the second case y=0 is a horizontal asymptote, as xm-n, that is, x in the positive integer power, makes the denominator large in magnitude for x's very large or very negative. Larger and larger denominator and constant numerator make the whole fraction closer and closer to 0. In the last case, it is the numerator that grows larger and larger (in magnitude) while the denominator remains constant. Of course, xn-m, that is, x in the positive integer power, is in the numerator. Hence, the whole expression grows larger and larger, unboundedly large, in magnitude, as x goes to plus or minus infinity. Thus, there is no horizontal asymptote.