Please see the following article It is thorough, well-written, and will tell you everything that you need, and more. However, if you prefer a less well-written summary, please read on.
Suppose that your investment accrues interest at the rate $r$ per period, with interest compounded every period. The period might be a year, a half-year, a day, or interest might even be compounded continuously. Or else, to be pessimistic, you have a debt, and interest accrues on it at rate $r$ per period.
Please note that we are using the mathematician's notion of interest rate. For example an interest rate of $8\%$ gives $r=0.08$. Actually, this is the same as the ordinary notion, since $8\%$ is an abbreviation for $8$ per centum, that is, $8$ per $100$, or $8/100$. But non-mathematicians are ordinarily more comfortable with $8$ than with $0.08$.
The Rule of $72$, and variants, have to do with the approximate doubling time, in periods, of your investment or debt.
By the formula for compounded growth at interest rate $r$, $A$ dollars grow to $A(1+r)^t$ in $t$ periods. Note that $t$ need not be an integer.
We want the doubling time, so we want to solve the equation $A(1+r)^t=2A.$ Divide both sides by $A$, then take the natural logarithm of both sides. We obtain $t\ln(1+r)=\ln 2$ or equivalently $t=\frac{\ln 2}{\ln(1+r)}.$
We want a quick and easy approximation for $t$, given $r$. More precisely, we wanted a quick approximation. Calculators are cheap and widely available, so we can quickly get a practically exact answer. Or ask Google. But back to the past.
By using the Taylor series for $\ln(1+x)$, or otherwise, we have $\ln(1+x)\approx x$ if $x$ is not too far from $0$.
So the exact formula above suggests the approximation $t \approx\frac{\ln 2}{r}.$
But $r$ is the mathematician's version of interest rate, where $8\%$ gives $r=0.08$. Let $R$ be the "layman's" number, which would be $8$.
Since $R=100r$, the approximate doubling time above, in terms of layman's interest rate, is given by
$t \approx \frac{100 \ln 2}{R}.$
Note that $100\ln 2$ is approximately $69.3$. And $72$ is reasonably close to $69.3$.
Let's take our numerical example with $r=0.08$. Then $72/8=9$, while $69.3/8 \approx 8.66$. Not a great deal of difference.
But please note that neither estimate is exact, since we used the approximation $\ln(1+r)\approx r$ in deriving the rule.
In fact, $\ln(1.08) \approx 0.07696$, so a very good approximation to the true doubling time is, in this case, $9.006$. Interestingly, the Rule of $72$, is, in this case, substantially more accurate than the Rule of $69$, or $69.3$. The use of $72$ makes up, to a large degree, for the inaccuracy involved in approximating $\ln(1.08)$ by $0.08$.
Details about the accuracy of the approximation are strongly dependent on $r$. For example, you might want to solve the following problem.
Exercise: You have borrowed some money from Break-Your-Legs Loans. The interest rate is $50\%$ per month, compounded monthly. Find the doubling time of your debt, and the approximate doubling time given by the Rule of $72$.