Nominal and real
The nominal rate is the one the bank quotes: how fast the number of dollars grows. Inflation is how fast prices rise. The real rate is how fast what you can buy grows. If your dollars grow by the factor 1 + n in a year while prices grow by 1 + i, your buying power grows by their ratio:
1 + r = (1 + n) / (1 + i), so r = (1 + n) / (1 + i) − 1.
This is the Fisher equation, named for the economist Irving Fisher. With 5% interest and 3% inflation, r = 1.05/1.03 − 1 ≈ 1.94%, not quite 2%.
The quick estimate
Most people simply subtract: r ≈ n − i. The estimate is too big by exactly (n − i)i / (1 + i), which is tiny when the rates are small and grows when they are large. Try the last what-if: at 30% interest and 25% inflation, subtracting says 5% but the truth is 4%.
Money in a drawer
Cash earns nothing, so its real return is 1/(1 + i) − 1: it loses buying power every year prices rise. After t years a dollar buys what 1/(1 + i)t dollars buy today. The rule of 72 works here too: divide 72 by the inflation rate to estimate how long prices take to double, and so how long a dollar takes to lose half its buying power.
This page leaves out taxes. Tax is charged on the nominal interest, so the real return after tax is lower still.