To file Form 1120-H for a year, an association generally must receive at least 60% of its gross income from member assessments and fees, and spend at least 90% of its expenses on acquiring, building, managing and maintaining association property. The election is made year by year, simply by filing the form.
Exempt function income, mostly member assessments, isn't taxed. Other income, such as interest and fees from non-members, is taxed at a flat rate after a small specific deduction, with no lower brackets.
Associations that don't qualify, or that would pay less tax another way, file Form 1120 instead. Comparing the two each year is a standard part of HOA tax work. This is general information, not tax advice; check the current IRS instructions for the year you're filing.