In modern vehicles with electronic distributors, a sensor monitors the position of the engine's crankshaft and sends a signal to an electronic control unit (ECU). The ECU then uses this signal to control the ignition timing and fire the spark plugs in the correct order.
The main purpose of a car distributor is to ensure that the spark plugs are firing at the correct time in the engine's firing cycle. This is essential for the engine to run smoothly and efficiently.