Next, when the car-end of the cable is plugged into the car (usually using either a T2 FEMALE - ie with 'sleeves' - plug or a Type 1, T1, or J1772 plug), the car's charger and EPC are directly connected by the PE (earth) conductor and a 4th wire in the cable called the Co-Pilot or 'CP' conductor. The first thing that happens is that the EPC 'advertises' to the car what the maximum current it can pull through the cable is (see the PP to PE Type 2 plug resistor coding in the paragraph above). The EPC achieves this by sending a square wave, 1kHz signal down the CP conductor. The car responds by modifying the square wave's 'duty cycle' (the proportion of signal 'high' to 'low') to tell the EPC/EVSE how much current it requires and also the square wave's peak-to-peak voltage to tell the EPC/EVSE when it is happy to commence charging. When this signal is made, the EVSE's main contactor - or relay - closes (usually with an very audible 'clunk'), thus connecting the other 2 wires in the cable, NEUTRAL and LIVE, to the mains and charging begins.
Aside from a fault stopping charging, there are several other ways it can happen. If someone accidentally or deliberately tries to disconnect a T2 plug during charging, you can imagine that with up to nearly 8kW of power going though the connection, if it were interrupted there would be quite an exciting plasma arc created which is obviously not safe. Also the electronics in everything would have a bit of a fit, potentially damaging them. To prevent this, the IEC62196 standard states that the male CP pin must be about 10mm shorter than all the others. Thus, if the plug is pulled out of the socket during charging, the CP disconnects first and will immediately shut down the power.
In the case of the T1 plug, there is a locking lever and associated button on the plug which must be activated to remove it from the car. As soon as this is done, the car charger stops pulling current.
Some T2 EVSE sockets have a solenoid operated locking mechanism installed which locks the T1 (male) plug into the socket when charging power is connected (or even when the plug is inserted and the EVSE switched on, before charging commences). Equally, some T1 plugs are also lockable, usually using a small padlock inserted though a hole in the button preventing it from being pushed and, therefore, the plug from being withdrawn from it socket.
Lastly, when the car has finished charging, it signals the EVSE by adjusting the peak-to-peak voltage on the CP line to stop supplying power and open the contactor.
I have simplified the description for the purposes of clarity. If you would like to learn more about it all then there is a good description here... If you are thinking about making your own EVSE (and saving yourself £200 or so) click here... for a DIY YouTube video made by the charity ZeroCarbonWorld.