The definition of derivative is

#f'(x)=\lim_{h\to 0} \frac{f(x+h)-f(x)}{h}#

In your case, #f(x)=\frac{x^2+1}{x-2}#. This gives us

#f'(x)=\lim_{h\to 0} \frac{ \frac{(x+h)^2+1}{x+h-2} - \frac{x^2+1}{x-2} }{h}#

Expanding #(x+h)^2=x^2+2hx+h^2# and taking the LCM of the denominators, we have can transform the fraction into

#\frac{(x^2+2hx+h^2+1)(x-2)-(x^2+1)(x+h-2)}{h(x+h-2)(x-2)}#

With a little bit of patience, we can expand the numerator, and we'll see that many things will erase: the numerator only is equal to

#x^3+2hx^2+h^2x+x-2x^2-4hx-2h^2-2-(x^3+hx^2-2x^2+x+h-2)#, which is equal to

#hx^2+h^2x-h-4hx-2h^2#

Taking the numerator back into the fraction, we see that we can simplify #h#:

#\frac{hx^2+h^2x-h-4hx-2h^2}{h(x+h-2)(x-2)}=\frac{x^2+hx-1-4x-2h}{(x+h-2)(x-2)}#

Now #h# appears only as an additive factor, so we can simply ignore it, since #h \to 0#. The result is thus

#f'(x)=\lim_{h\to 0}\frac{x^2+hx-1-4x-2h}{(x+h-2)(x-2)}=\frac{x^2-4x-1}{(x-2)^2}#