Now many companies recently have chosen not to distribute profits - e.g. Amazon reinvests everything back into growth.
And there are types of share that don’t give you a vote on who runs the company (or your tiny ownership percentage makes it meaningless).
And there are companies that don’t make any profits so there’s nothing to share out!
But shares, at least classically, do have an inherent value.
Edit: Examples of these classic shares are “Dividend stocks” [0], but even with say TSLA or AMZN when you buy a share you’re buying the right to a share of the future profits.
[0] https://www.investopedia.com/dividend-stocks-4689744
Edit2: Now of course that inherent value might be zero if the company will never make a profit…