Actually the ground has nothing to do with the GFCI operating. GFCI's operate with a small current transformer that surrounds both the live and neutral wires. The secondary winding is connected to a sensitive electronic detector, which can trigger a circuit breaker or contactor in series with the 120-volt line. Under normal conditions, the line current in the line conductor is exactly equal to the current in the neutral, and so the net current flowing through the current transformer is zero. Consequently, no flux is produced in the core, the induced voltage is zero, and the circuit breaker remains closed.
Suppose now that current IF leaks directly from the live wire to ground. This could happen if someone touched a live terminal. A fault current would also be produced if the insulation broke down between a motor and its grounded enclosure. Under any of these conditions, the net current flowing through the CT is no longer zero, but equal to IF. A flux is set up and a voltage is induced which trips the CB.