If it is in your deed that the homeowners association is manditory than you will need to follow the association rules. If it is spelled out in your deed, than you are bound to the association by purchasing the property, whether you sign the association document or not. The best time, of course, to clarify this is before you purchase.
If you are purchasing or have purchased a home in a community that has a mandatory homeowner's association, then you must be a member in order to own that home. If it is a voluntary homeowner's association, then no, you do not need to become a member or sign any documents.
It is defined by those homes that are built under the jurisdiction of the home owner's association. If you don't want to belong to an HOA, don't move into one.
When you purchase a home in a neighborhood with a HOA you are required to accept the HOA regulations at the closing table. Therefore, yes, you have to sign in order to close.