The way air-bags work, in general, is that an array of sensors (including acceleration/shock sensors, and possibly gyroscope/spin rate sensors) feed into a computer control unit. Using the data, the computer determines the pattern of impact, and using a set of rules determines whether the air-bag(s) should deploy.
The air-bags are operated by electrically detonated explosive charges, which produce a controlled burst of high pressure gas to inflate the bags - similar explosive charges may be used to increase the tension in seat-belts during impact (seat belt pre-tensioners).
The air bag control unit may be powered even when the car is off, and probably usually is. But I suppose, it may vary between manufacturers.
There are several concerns over maintaining or servicing air-bag equipment. Any unintended short circuit (e.g. cable damaged, incorrect connection, slipped multimeter probe) in the air-bag circuit could potentially energize the detonator - because of this, the recommendation is that no maintenance be carried out on an air-bag system unless the battery is disconnected and/or removed from the vehicle. Even then, there are strict maintenance procedures to be followed, as there is a theoretical risk that static electricity, or test currents from a multi-meter probe, could trigger detonation.