At the time I bought a house so I broke the lease to move in. Fortunately, the apartment rented within the month so I didn't owe additional fees.
Out of curiosity I googled "rent acceleration" and see it is a hot topic now - mostly with commercial real estate and businesses break their leases due to the impact of covid on them. See https://www.jdsupra.com/legalnews/what-landlords-need-to-kno... for a summary. Also interesting is some US states make residential leases exempt from rent acceleration.
Several of my past leases specified that if broken I would be responsible for monthly rent on a prorated basis until a new tenant moved in.
For rent specifically, you can arrange to have a mutual agreement with the landlord if you for example find a new tenant, but by law the landlord does not have to accept anything.
Some contract also have punitive clauses in it, saying that you can break the contract at any point with 1 months notice, but you have to pay 3 months' worth of rent.
In my experience, typical apartment leases are offered on a 12 month basis. Month to month is usually substantially more expensive.
If you break a 12 month lease early, you're legally on the hook for whatever the contract specifies (typically the entire year in my experience). Most landlords will "generously" agree to let you out of the lease for the equivalent of a couple monthly installments though (again, just my personal experience).