How many ordered pairs are there in order for $\frac{n^2+1}{mn-1}$ to be an integer? For how many ordered pairs of positive integers like $(m,n)$ the fraction
$\frac{n^2+1}{mn-1}$
is a positive integer?

We have:
$$n^2+1=kmn-k$$
so we have $n$ divides $k+1$ we can write $k+1=nt$ so that $$n^2+1=(nt-1)(mn-1)$$
but if $m,t,n>1$ we have $(nt-1)(mt-1)\geq (2n-1)^2>n^2+1$impossible
if either $t=1$ or $m=1$ in the two cases $n-1$ divides $n^2+1$ but we know that $n-1=\gcd(n^2+1,n-1)=1$ or $2$, so that $n=1$, $n=2$ or $n=3$ and here you have finite cases to find $m$
