From a logistics and administrative perspective, there's a world of difference between a condo complex, a gated community with some shared resources, and an established neighborhood full of single family dwellings. Whether a HOA is a good idea depends in part on what kind of community it is and whether there are shared resources that need to be managed or paid for.
In a condo, the general rule is that you "own" everything from the sheetrock in, and there are some shared resources that might include a pool, a driveway, and the roof. These resources require upkeep of some kind, and the upkeep is not free, so there's got to be some means for paying for it and making sure everyone pays their fair share. Generally that service is provided by a HOA and the work is often outsourced to a property management company, but a big enough building may have its own staff. So, to live in a co-op or condo, people trade off some freedom in exchange for a higher standard of living. They get the pool, the park, the snow removal service, and whatever else. But they don't have to cover the entire cost. The HOA has a laundry list of rules generally intended to help everyone get along and enjoy their property equally, and my right to swing my proverbial fist ends where someone else's nose begins. Exactly what that means varies from one complex to the next. The more swanky the complex, the more restrictive the covenants. Also, there are going to be regular dues plus special assessments for large purchases. The more shared goodies there are, the more it's going to cost to live in the building.
Realistically there's not going to be any way to manage a condo complex like that if participation is voluntary, because there will always be people who don't think they should have to contribute to things they don't use. They won't want to fork out an extra $1,000 here and there for a new roof when they live on the ground floor and won't directly benefit, or they'll object to the clubhouse renovations because they don't use the clubhouse. If participation is voluntary, it's going to be less than 100%, and that means a lot of necessary repairs just don't get done. If something happens to the HOA and the work doesn't get done, the property starts to deteriorate for lack of repair, and that affects everybody's property value. But because of the amount of money involved, there tends to be a lot more resident oversight and fewer opportunities for corruption or mismanagement.
At the other extreme, a neighborhood with no shared resources can get by just fine without a HOA. With no signs, medians, grassy areas, or anything else to maintain, there aren't any shared costs. So the only way a HOA can add value is to maintain order and standards in a neighborhood. They generally do this by enforcing restrictive standards that exceed the existing local ordinances for zoning, building, pets, or parking. Whether this contributes to overall property value is currently the subject of debate. Many people on this board have had bad experiences with corruption and selective rule enforcement (A and B both have tall weeds in the front yard, but only A gets a ticket for it). Their complaints are legitimate. But there are also people who care about neighborhood look and feel. They don't want to look at ugly things on someone else's property, they don't want large amounts of traffic on their street, and they care whether non-native plants and trees are being introduced into the ecosystem to compete with the native ecology. People who care about that sort of thing and are willing to spend money to get it tend to keep their own property up pretty well. A HOA helps guarantee that they're surrounded by other people who feel the same way, and who are willing and able to spend money on atmosphere. It also helps them shun and get rid of People Different From Themselves.
In between these extremes there are communities where shared resources exist. Consider a gated community. Each household gets to decide whether to replace their own roof, but everyone has to chip in for the gate and driveway. Do the gate and fence add value from a security perspective? In some markets, yes they do. There's a direct relationship between whether a HOA or similar governing body exists, and the quality of life you experience while living in the neighborhood.