this is done in sequence to each spark plug via the ignition coils and distributor
the spark plug ignition is activated and precisely controlled by an electronic ignition system that centers around the ECU, ignition coils, and electronic sensors
when the ignition key is turned and the engine is cranking or running, the ECU uses signals from the crankshaft and camshaft position sensors to determine the exact timing for ignition
the ECU sends a low-voltage signal to the ignition coil for the appropriate cylinder.
the coil rapidly builds a magnetic field, then collapses it, converting the battery's 12V into a high-voltage pulse (typically 20–40 kV) across the spark plug
this high voltage is sent via a spark plug wire (or directly if coil-on-plug) to the spark plug, causing a spark at precisely the right moment to ignite the air-fuel mixture in the cylinder
most modern cars have a fully electronic ignition system — there is no mechanical distributor as with older cars