A flyback transformer works by storing energy in its magnetic core when current flows through its primary winding. When the current is interrupted, the stored energy is released into the secondary winding as a high voltage pulse. This pulse can be used for various applications.