> On a higher level, some potential buyer will look at the companies financial statements, and figure out if the share price is too high / low for how the company is performing, from a financial standpoint. This is called "fundamental analysis", and you can easily find step-by-step analysis reports of such on various companies.
How does this work if a company doesn't pay out dividends? There's no investment to return unless someone buys from you at the same or higher price... right?
There are multiple ways to do this analysis, and not all of them come from evaluating them as investments. Stocks represent an ownership stake in the firm, and you can use any method you want to give a number to what the firm's "value" is. This could be by reading financial statements, comparing it to other existing companies, seeing how much their operating cash flow is and so on.
How does this work if a company doesn't pay out dividends? There's no investment to return unless someone buys from you at the same or higher price... right?