I've personally never lived in an HOA (and would refuse to move into one), but the best ones, from what I've heard of through friends and family, are those that are hands-off, namely:
1) Optional -- This puts the onus on the HOA to actually serve its residents, because if enough people dislike it enough to leave (after, say, a few elected residents go on a power trip), it will collapse.
2) Give access to neighborhood amenities (e.g. a pool or clubhouse)
3) Provide neighborhood services (e.g. snow removal or tree trimming, extra trash collection)
4) Are NOT in the business of mandating minutiae such as grass length, paint color, approving remodel plans, handing out fines, etc
5) Are NOT part of a private developer's subdivision (usually goes hand in hand with point 4) so much as a collection of residents which formed organically
Basically, I like the idea of HOAs if they're more similar to Los Angeles's Neighborhood Councils than LAPD: Home Edition (although, for so many other reasons, I think LA's Neighborhood Councils are unrepresentative and ineffective at serving the wider community's best interest so much as they benefit exclusively the homeowner's interest). Otherwise, I strongly believe they cause more harm than good -- not to mention they can easily be weaponized against a minority homeowner moving into a majority-white community.
Unfortunately, it seems like HOAs as described above are in the vanishing minority.