There are plenty of ways to monetize a community. Just to mention some of them:
Ad revenue come from joining an ad network like Google AdSense. With simple copy/paste code into your community, you get money every time the members see or click on the ads.
Affiliate marketing is getting a commission from sellers every time you sell their products or services to one of your members or visitors. Selling means putting affiliate links and not a personal sale conversation.
Files sharing allows your members to upload files into your community and charge for them. If the files (also images, videos) are bought by other members, you get a commission as community owner. The amount of the commission is set by you.
Ecommerce is selling products, also digital products, to your members and visitors.
Membership site can charge for using it. Like creating paid courses or access to exclusive content.