Use this wiring when the power source originates at the switch and you want to control both the fan and light from there. The hot source is connected directly to the bottom terminal on the switch. Two-wire cable runs from there to the ceiling fan.
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.
Run the cable through the clamp and tighten it down. Splice the cable wires to the fan wires using a pigtail splice and a wire nut. Connect the ground to the grounding terminal in the connection box and the ground wire from the fan, if there is one.
In this diagram, two receptacle outlets are wired in the same box with a separate 120 volt source feeding each. Three-wire cable runs into the box. The black and red wires are hot and each is connected to one of the receptacles. The white, neutral wire is splice to each outlet so they share the return path. This is appropriate for standard duplex receptacles, but should not be used for GFCI receptacles. GFCI’s must have dedicated neutral connections to work properly.