The GFCI has a torroid with Hot and Neutral single turn loop wound in opposite directions creating equal but opposite fields in the torroid core (cancelling effect). The torroid also has a sense winding (many turns) that feeds into the detector/controller I.C.
If the hot line current does not exactly equal the neutral line current, there is some residual field signal that is picked up, amplifed, and detected by I.C.
They are pretty remarkable, able to detect 10 to 20 uA's of mis-match in hot to neutral lines with a hair drier drawing 10 amps. The leakage path being a path to ground through the person.