The general concept is that your money will grow at an accelerating rate because you start getting interest paid on your returns in addition to the original investment.
As a simple example, assume you invest $100 and get 10% interest per year paid annually.
-At the end of the first year you have your $100 + $10 interest for a total of $110.
-So you start the second year with $110 and so 10% would be $11 for a total of $121.
-The third year you start with $121 so 10% would be $12.10 for a total of $133.10
See how the amount it goes up each year increases? If we were talking a higher initial amount or a larger number of years that can really add up. That is essence is compound interest.
Most of the complicated looking formulas you see out there for compound interest are just shortcuts so you don't have to iteratively go through the above exercise a bunch of times to find out how much you would have after some number of years.
This formula tells you how much you would have(A) after a certain number of years(t) at a given interest rate(r) assuming they pay interest n times per year, for example you would use 12 for n if it paid interest monthly instead of yearly. P represents the amount you started out with.
If you keep investing monthly (as shown in your example) instead of just depositing it and letting it sit, you have to use a more complicated formula. Finance people refer to this as calculating the future value of an annuity
That formula looks like this:
A = PMT [((1 + r)N - 1) / r] x (1+r)
A : Is the amount you would have at the end of the time period.
N : The number of compounding periods (months if you get interest calculated monthly)
PMT : The total amount you are putting in each period (N)
r: Just like before, the interest rate you are getting paid. Be sure to adjust this to a monthly number if N represents months (divide APR by 12)*
*Most interest rates are quoted as APR, which is the annualized interest rate not counting compounding. Don't confuse this with APY, which has compounding built into it and is not appropriate for use in this formula.
Inserting your example:
r (monthly interest rate) = 15% APR / 12 = .0125
n = 30 years * 12 months/year = 360 months
A = $150 x [((1 + .0125)360 - 1) / .0125] x (1+.0125)
A = $1,051,473.09 (rounded)