Newly issued shares are sold on the stock market? When a company issues new shares in order to raise it's capital, can it sell those shares on the stock market? Or they have to be sold outside of the stock market?

I mean in general, rules can differ from one country to another.
A company will typically employ an investment bank to act as an underwriter when it wishes to issue new stock. The investment bank essentially agrees to buy the issued stocks from the issuing company and its job is then to sell them to investors.

Investment banks employ a sales force who try to persuade large investors (such as pension funds) to commit to buy the stocks before the date of issue. If the investment bank does a good job then all of the issued stocks will be allocated to a buyer in advance. If the investment bank fails to fails to find enough buyers then it is stuck with the unsold stock and must try to sell them to the public in the stock market.