system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why does the stockmarket exist?
gpt
Stocks were invented as a way to share risk. European countries had trading expeditions going to Asia and Americas. These expeditions took months or years and were hugely expensive to fund but when successful they were absurdly profitable. The problem was that a ship could sink or get robbed by pirates, or a number of other problems.

The investors also had to stay solvent while waiting for the ship(s) to return.

At one point some very smart people in Netherlands figured that if they sold "shares" of these expeditions they could get many more people involved as investors, thereby the risk would be shared among a greater number of people/companies.

Once the expedition returned the company was dissolved and the profits, or losses, were divided up according to who owned what percentage of shares. Your reward was directly related to how much you invested.

Over time this mechanism evolved to companies in general, not just companies setup for trading expeditions.

Simply put it's a way to raise capital, across a large number of investors which all shares the risk and reward.