According to Mental Floss, the luminescence inside glow sticks comes from a chemical reaction between two substances that releases energy as light. The exact chemical makeup of a glow stick can vary from manufacturer to manufacturer, but most use hydrogen peroxide and a chemical called a diphenyl oxalate ester. When the two liquids mix inside the glow stick, they produce a light colored by a phosphorescent dye.
A typical glow stick consists of a thick, flexible plastic tube filled with the oxalate ester and dye solution. In the center of the tube is a fragile capsule containing the hydrogen peroxide. When the tube is bent, this capsule breaks, and the two liquids combine and begin to react.
One of the chemicals formed by this reaction is a peroxyacid ester, a particularly unstable compound. This compound decomposes, passing through multiple phases and releasing energy into the surrounding molecules. When this energy strikes the dye molecules, the electrons in those molecules briefly jump to a higher energy level. As they return to normal, the atoms in the dye molecules emit photons, creating the glow stick's fluorescent glow.
Because it can take some time for the decay process and the energy emissions to happen, a glow stick is capable of providing light for some time before all the energy is exhausted.