How does a GFI work?
By “work” here you mean how does it know to trip off. (A GFI receptacle/outlet also “works” as any outlet does: by running what you plug into it). A GFI trips off (stopping power at itself and at any normal outlets wired downstream from it) by comparing how much current is flowing on its hot versus its neutral wires; it trips if these are different by a small fraction of one amp, which would be the result of someone being shocked (giving current an alternate path than just between hot and neutral). But, unfortunately, many other conditions are able to trip these devices than someone being shocked.