The stock market allows companies to raise funds by issuing shares that are then traded on exchanges or over-the-counter markets. It serves primary functions like allowing companies to raise capital through initial public offerings and secondary functions like providing a platform for buyers and sellers to trade existing shares. The cash market allows immediate trading of shares for payment while the derivatives market trades contracts whose values are derived from underlying assets. Key players include exchanges, regulators, investors and various facilitators.