Here is a diagram from wikipedia RCD entry and really simplified description to help you visualize what is inside a typical GFCI outlet.
Both hot and neutral (L/N) conductors pass through the core of a single current transformer (3). Ideally the currents flowing through L/N are identical and in opposite direction, so effectively zero current flows through the coil (2).
But when there is some leakage current from either L or N (to some grounded human or grounded object) the electromagnet (1) disconnects both L/N conductors from the outlet.
The ground conductor (when available) is connected straight through to the ground of the outlet. So when a GFCI outlet has tripped, ground prong is still connected to ground, but the L/N prongs are both floating.
P.S. The test switch (4) bypasses about 5mA from L to N.