YouTubers get paid through ads and sponsorships.
There are 2 kinds of YouTube ads - pre-roll and bumper. Pre-roll are the ads that play before a video and give the viewer the option to skip. Bumper ads are quick ads that play in the middle of longer videos and can’t be skipped. The higher your video’s view count, the more the ad plays, the more money you make. When an ad is watched in its entirety, the channel makes even more.
When a company pays to have their product mentioned or used in the YouTube video directly, it's a sponsorship. You see this a lot in toy unboxing videos and movie promotions. As a YouTube video creator, it’s a good idea to connect with companies in your niche.