The idea of an HOA is that all of the neighbors join together to maintain infratstructure that they all enjoy. HOAs take two forms, voluntary and mandatory.
In a voluntary HOA, membership is just that, voluntary. Each home decides whether or not to participate. The HOA usually does some community building activites, may form a crime watch, and sometimes does little beautification projects like planting flowers by the neighborhood sign.
A mandatory HOA exists when a neighborhood is built with additional community infrastructure such as a community pool, private parks, gated entrance, etc. Membership is mandated in the deed to each property. There are guidelines established for how the HOA is to run, how dues are determined, etc. These HOAs are frequently managed by professional companies and take care of the maintenance of all of the common grounds.
Fees for voluntary HOAs are usually very small – less than $100/yr. Fees for mandatory HOAs all depend on the amount of common infrastructure in the neighborhood and can range from $50 to hundreds of dollars per month.