Inverting Amplifier Generalized Gain Derivation
This is your typical inverting opamp configuration:






simulate this circuit &ndash; Schematic created using CircuitLab

The one thing you know for sure is

$$V_o=A_{ol}(V^+-V^-) $$

and notice I am not even talking about negative feedback here. The output always follows that equation and what limits the output voltage are the rails or supply voltages (\$V_{cc}\$ and \$V_{ss}\$).

Now, back to the equation provided. In order to find the gain, you want to express it in terms of \$V_{in}\$ and \$V_o\$.

You can easily see that \$V^+=0\$. You can find \$V^-\$ in several different ways. For simplicity here is what \$V^-\$ is:

$$V^-=\frac{R_2}{R_1+R_2}V_{in}+\frac{R_1}{R_1+R_2}V_o $$

If you plug those values into the \$V_o=A_{ol}(V^+-V^-) \$ equation, you get:

$$V_o=-A_{ol}\bigg(\frac{R_2}{R_1+R_2}V_{in}+\frac{R_1}{R_1+R_2}V_o\bigg) $$

After some algebra, you can find \$\dfrac{V_o}{V_{in}}\$ to be:

$$\frac{V_o}{V_{in}}=-\dfrac{R_2}{R_1+\dfrac{R_1+R_2}{A_{ol}} }$$

So, in order for the gain to be approximately \$\dfrac{V_o}{V_{in}}\approx -\frac{R_2}{R_1}\$, the open loop gain has to be large enough so that the \$\dfrac{R_1+R_2}{A_{ol}}\$ term in the denominator is negligible.