At the instant the switch opened, generated current flowing in the magneto was cut off and the sudden collapse of the magnetic field it was generating induced a high-voltage pulse in a winding of fine wire. This pulse, arriving at the spark-plug’s gap through the ignition wire, produced a steeply increasing electric field across that gap. If all was well, random free electrons that happened to exist in that gap were accelerated by the electric field, gaining enough energy to, in turn, knock electrons off of gas molecules in the gap. This became a chain reaction, allowing an avalanche of electrons to flow across the gap. The vast number of electron-to-gas molecule collisions transferred this energy to the gas, heating it explosively (that’s the “snap” you hear when a spark jumps a plug gap, and it is also the explosive crash when lightning discharges close by). If that gap contains fuel vapor as well as air, the spark discharge may very well ignite it; riding a combustion-powered motorcycle absolutely depends on it!