What does an HOA even actually do?

They are supposed to use their funding for local projects like keeping the neighborhood park clean and tuned up, making sure shared green areas are kept tidy, and making sure nobody is polluting their streets with garbage, etc. However, every story I seem to come by about them makes me think that most HOAs are just run by a bunch of entitled neighbors who enjoy a power trip. Homeowners pay HOA fees in hopes that their neighborhood is going to be taken care of. Instead, they get fined and forced to dish out more and more money for silly little things like picking a color the HOA board didn't like for your front door, letting your bush grow in a different way than everyone else, or even just putting up some Halloween decorations. If I were a homeowner (LOL I wish…), I would never willingly live in an HOA-controlled neighborhood. And yet, people still do. Why is this?