Before when the switch is not flipped a piece of wire is sticking out not finishing the connection. As soon as the switch is flipped, it connects the wire and allow electrons to flow from one side of the battery to the next. Because of the connected wire, there is a current of electrons flowing through the circuit. When everything is flowing right the light will be on because it can be powered by the electrons and electricity in the circuit. As soon as the switched is flipped off the connection is broken from the no longer connected wire and the light bulb is off.