Shares are issued by companies in order to get funding that never has to be repaid. In return shareholders get one vote in shareholder meetings per share that they own and a right to receive dividend payments forever at the discretion of the company board. The upside on shares is unlimited but this comes at the price of high volatility.
This is because the future cash flows of a share are highly uncertain, and in the event of bankruptcy shareholders are at the back of the queue to be repaid behind bondholders. Although share prices fluctuate wildly given their high volatility over the long term they tend to track the amount of earnings they generate, which is why a common measure of share value is the price to earnings ratio.