The exchange may offer privileged services like high-frequency trading to larger clients like mutual funds and asset management companies (AMC), and earn money accordingly. There are provisions for regulatory fee and registration fee for different profiles of market participants, like the market maker and broker, which form other sources of income for the stock exchanges.
As a primary market, the stock market allows companies to issue and sell their shares to the common public for the first time through the process of initial public offerings (IPO). This activity helps companies raise necessary capital from investors. It essentially means that a company divides itself into a number of shares (say, 20 million shares) and sells a part of those shares (say, 5 million shares) to common public at a price (say, $10 per share).