Public money is looking for profits. Dividends are one way to get there. A better way to get to larger profits is selling the stock after it gets much more valuable. In the example above the growing company has a good chance of being worth much more a few years later, and that increases the value.
> why is Amazon, a company that has never paid a dividend, such a valuable company?
You'd hope every publicly-traded long term minded company operates the same way Amazon does. Reinvestment of money they themselves earn in "growth" and still retain a trickle in profits.