I have seen several aircraft that do not have an operative APU, so how are lights, air, and other systems kept running?
The aircraft is connected to a ground-based supply.
The ground-based air conditioning is connected using a large yellow pipe, and electricity is connected using a set of cables. In the photo below you can see both connections. image source
In the cockpit, the pilot can select the power source for the aircraft. The proper procedure is to start the APU before disconnecting the ground power supply, otherwise the whole cabin will go dark once ground power is switched off! If you are a passenger boarding, you may have noticed that the cabin lights flicker for a very brief moment. This is when the power source is switched from ground power to APU, as part of the start up procedure.
If the APU is inoperative, things get a little complicated. Typical electricity source include ground-based supply, APU, engines and battery. The battery is only a backup for very essential flight instruments; it is not even capable to power everything in the cockpit, let alone the cabin. The ground-based supply unit must be disconnected before the aircraft starts moving. So that leaves the engine(s) as our only power source.
However, getting a turbine engine started without an APU is a tricky matter in its own: it requires another ground-based unit to blow air into the engine. The only remaining option is to keep at least one engine running during the turnaround, since the running engine can be used to power up all other engines, at the expense of fuel.
Generally, aircraft that have no APU or an inop APU will rely on a ground power unit to keep the lights on when parked.
On aircraft like the ATR72, engine #2 can be left running in 'Hotel mode'. This will allow ground activities to continue without requiring ground equipment. It's mostly used for short transits. The key component is a 'prop brake'. It's very noisy though.
Once the aircraft is ready to move, the prop brake will release and the prop will go from stationary to a fast spin almost immediately. Engine number one is then started. It will spool up from sloooww... to fast... to idle (faster).