I have the function
$$f(x) = \frac{x}{x^2 - 1}$$
The domain of this function is $(-1,1)$ and the range is $\mathbb{R}$.
When I find the inverse of this, this becomes
$$f^{-1}(x) = \frac{1 + \sqrt{4x^2+1}}{2x}$$
The domain seems to be different, now that I cannot have zero in the denominator. This should match up with the range of the initial function. Why does this happen?
Best way to think of it: write your function as $y$ in terms of $x$, your aim is to find $x$ in terms of $y$. We have $$y=\frac{x}{x^2-1}\quad\Leftrightarrow\quad yx^2-x-y=0\ .$$ If $y=0$ obviously $x=0$, if $y\ne0$ we can use the quadratic formula to get $$x=\frac{1\pm\sqrt{1+4y^2}}{2y}\ .$$ There must be only one value of $x$ so we need to decide whether to take the $+$ sign or the $-$ sign. One way to do this is to note that $x$ will be a continuous function of $y$ (draw the graph of $y$ in terms of $x$ to see this), and $$\frac{1+\sqrt{1+4y^2}}{2y}\to\infty\quad\hbox{as}\quad y\to0\ ,$$ so we must reject the $+$ sign (note that you got this wrong).
So the inverse function is $$f^{-1}(y)=\cases{0&if $y=0$\cr \frac{1-\sqrt{1+4y^2}}{2y}&if $y\ne0$,\cr}$$ or if you prefer $$f^{-1}(x)=\cases{0&if $x=0$\cr \frac{1-\sqrt{1+4x^2}}{2x}&if $x\ne0$.\cr}$$
Alternatively we can rationalise the numerator to get $$f^{-1}(y)=-\frac{2y}{1+\sqrt{1+4y^2}}$$ which is valid both for $y\ne0$ and for $y=0$.