General Stock question

Since the stocks what people buy is kept under CDSL/NDSL as shares. How come the company get profit out of it and how can a company invest our money in the operations and development and see profits out of investors money?

the shares are merely a certificate /symbol of having invested in company as a financial partner.the money is with the company only .