In my California city, the Fire Dept. conducts inspections every one or two years, in connection to Certificates of Occupancy, etc.
Responsible property owners simply comply, giving the FD access when requested.
The FD is looking for obvious dangerous conditions, proper signage for exits, the number and type of exits, etc.
Building codes require two (or more) stairways if a building exceeds certain sq. footage thresholds, etc.
Smoke detectors, fire alarms, sprinklers, etc. are inspected.
Insurance companies require evidence of compliance. Mortgage holders require insurance for their collateral.
The owner failed, the tenant failed, the city officials failed to conform to standard, good safety practices.
It is claimed to be very difficult to succeed in liability and negligence lawsuits against government entities.
With 36 dead, I predict some lawyers will test that very seriously.
Most of all, the building owner.
The NFPA and Uniform Fire and Building codes are recognized nation wide and to my knowledge have been strictly enforced in CA for many years, at least by non corrupt city and county fire departments.
There’s much blame for everyone involved in this and no doubt there’ll be lawsuits, criminal charges are warranted in my view but probably won’t happen.