When the original buildings were completed and sold, the construction company takes their money and runs. But before doing so, they will have set the complex up to be self-managed through a Home Owner's Association (HOA) and will transfer ownership of the buildings and common areas such as elevators, pool, etc. to the HOA. Each individual owner owns and maintains what is within the walls of their unit and - as an owner - also owns a tiny portion of the buildings and common areas and is therefore responsible for upkeep.
The owners then elect - from within the membership - a Board of Directors and it is this body that has the responsibility of setting the amount of monthly dues and directing the operation, management, repairs and maintenance of the buildings and common areas of the complex. The Board can hire a management company to oversee day to day operations or hire and oversee its own maintenance crew.
The original builders will have set up a Reserve fund that is to be used for major maintenance and replacement of items such as roof, elevator, etc. ( Think of it as a separate savings account that you might keep to replace things such as washer, refrigerator, AC etc. ) Continuing expenses such as day to day operation (electric bill, maintenance staff, insurance, routine R & M) is paid through monthly dues. As the Reserve fund is depleted, it is the job of the Board to keep it funded by raising the dues as needed. If the Reserve is not fully funded and a necessary repair happens, the Board of Directors must levy an assessment to cover costs.
Serving on an HOA Board of Directors is a thankless and unpaid job and few want it. Owners in a complex often look at the Board as the enemy because " they keep wanting to raise my dues". Keeping dues low trumps protecting the investment. It's the same thing as a person who owns a house and refuses to maintain it because of the expense. There are basic rules and regulations but each individual Board decides how the money is spent. They can buy new pool furniture and repaint the tennis court every year or they can save to replace the rotten pilings on which the building sits.