Central locking systems work through the use of a central computer in the car called a "body controller," which relays signals to the locks of the vehicle and monitors whether they are locked or unlocked. This system is a form of power door locks.
Each car door has an apparatus called an actuator, which consists of a series of gears and a latch connected to a rod. The central computer sends power to the actuator, causing the gears to rotate, which causes the latch to either attach or detach itself from the car door, locking or unlocking it.
In modern vehicles, the central locking computer in the car can send signals to all the actuators at once, such as when a remote control device for keyless entry is used or a button inside the car is pressed. When the actuators receive the "lock" or "unlock" signals, they attach or detach their latches accordingly. This central computer is also responsible for determining whether the lights were left on or whether you left your keys in the ignition.
In vehicles with power lock systems but without a central computer, the locking mechanisms are activated by providing power to the actuators directly, over a timed interval.