The black cable wire is connected to the top terminal on the switch and spliced to the black and blue wires at the fan at the other end. The neutral source and ground are spliced through to the white and ground connections at the fan.
In this wiring, the source is at the switch and 3-wire cable runs from there to the fan/light. The switch controls the light and the source is spliced through to the fan. With this arrangement, the fan is controlled by a pull-chain on the motor housing and the light is controlled with the switch. The neutral and ground wires are also spliced through to the fan/light.
This ground fault circuit interrupter wiring diagram of the same device leaves the switch out of the protected circuit. With this arrangement the receptacle is protected but the switch remains outside the circuit. This arrangement can be used to control a light or other device where the extra protection of a gfci is not necessary.
This page contains wiring diagrams for ground fault circuit interrupter (gfci) receptacles. Included are diagrams for multiple gfci’s, a protected standard duplex receptacle, and a protected light fixture. Wiring for a switch and gfci receptacle in the same box is also shown to protect the switch and light or to protect other receptacles in the circuit. To wire a gfci circuit breaker see this link and wire a gfci switch combo at this link.