A fault to earth
(whether it be via the protective conductor or otherwise)
The phase and neutral pass through the RCD, and they are wound around an iron core, a search coil is also wound around the same core and it acts as a transformer, the magnesium in the core induces a current in the search coil.
The currents normally sum to zero, as the neutral current is equal and opposite to the line current, but if one should be a little lower (hence there must be a leakage to earth somewhere), it no longer sums to zero and a current is induced in the search coil, which activates the trip mechanism.
The test button connects the outgoing line, via a resister to the incomming neutral to cause an inbalence on purpose.
Some of the modern devices do have an earth connection for the elctronics inside them, but the protective conductor of the circuit does not pass through the device.
Before RCDs, there were voltage operacted earth leakage circuit breakers (VO-ELCBS) which did have the earth of the installation connected through them, and worked on the volatage to earth, they are no longer reliable and have not been installed in the past 25 years, they should be replaced with RCDs
Current operated earth leakage circuit breakers were just RCDs made before the terminlogy was fully hammered out, so are fully acceptable as long as they test out