A stock split is an accounting adjustment where the percentage of an investor's acquired holdings in the company doesn't change in the event of an increase or decrease in the number of shares outstanding. For example, if a company has an initial 100 shares outstanding with a market cap of $100, the share price would be $1. If you bought 20 shares at $1 per share, this means you own 20% of the company valued at $20. When the company declares a 2:1 split, it doubles the shares outstanding to 200 but this doesn't magically increase its market cap to $200 and decrease your holdings percentage because there are now more shares in contrast to your current number of shares owned. The company would still have the same market cap of $100 but since it now has 200 shares outstanding, the company's price per share would be down to $0.50. As an Investor owning 20 shares, you would still own 20% of the company but this time the number of shares you own would double to 40 at $0.50 per share.
A stock split has a cosmetic purpose on a company's stock that is, it makes the stock look cheaper or more expensive. A company declaring a 2 for 1 split (2:1) would cut its $100 per share stock price to $50 attracting more investors to buy the cheaper looking stock and thus, lift its share price as a result. For example there are two competing bakeshops selling their stock to the public, their market cap is $100 and each has 100 shares outstanding. Now, the other bakeshop could make its stock price look cheaper by doubling its shares to 200, its share price is now priced at $0.50 per share.