I think to build a community you need a motive, it could be getting people to get access and test some next gen tech or a solution to one of their problems which they want to be solved. Other elements (writing pointwise like a school student):
- A platform which focuses on the target audience you want. Example, instead of linkedin, you might want to create a community on behance (less sure if it allows) if you are doing something related to design.
- Be a part of other communities which have your target audience and ask for help there.
- Keeping things less spammy and more exclusive works a lot, but it depends on your need.
- You can reward people to participate in your community (kind of on the lines of giving goodies to use your product, sometimes I don't prefer it morally, but at some places it fits in perfectly)
- From my experience, community always needs someone who drives it (just like religion may be), members will engage if you give them something to do.
We're building a product for developer communities (www.commudle.com), a first of it's kind ecosystem which is centered on developer centric activities (discord is great, so is slack and all the amazing community & event platforms, but they are not focused on developers...).
DEV's a great community to be in!