Flame (or heat) detection is based on temperature dependence of the LED's forward voltage. This voltage is measured (at very low LED current) by internal ADC of PIC12F1501. If the LED voltage under some predefined threshold for long enough time, LEDs are activated and start flickering.
Big candle (with 4 LEDs) is powered by Li-Ion battery (yes, i know it's dangerous...) and is equipped with USB charger (MCP73831) and small one (with one LED) is powered by CR2032 or LIR2032. Small candle can be even put out with fingers.