Most commonly, light bulbs explode when manufacturers do not put enough insulation on the base of the bulb, which causes the base to melt and allows the gas stored in the light bulb to leak out. The leaking gas causes a pressure difference which results in the light bulb exploding.
A light bulb can also explode for a variety of other reasons, including faulty manufacturing or wiring. If an incandescent bulb does not have a quality seal, condensation can get inside and cause an explosion.
Halogen bulbs can explode from a person simply touching them since the oils left cause a temperature difference.