The hot source is spliced to the black, fan wire and the black wire running to the dimmer. At the other end, the black cable wire is spliced to one of the hot dimmer wires, it doesn’t matter which one. The other dimmer wire is spliced to the red wire in the switch box which is spliced to the blue, light wire at the other end.
This diagram illustrates the wiring for a circuit with gfci receptacles followed by an unprotected light and switch. The light switch is connected directly to the source and the load terminals on the gfci are not used.
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.
Here one ground fault circuit interrupter protects multiple duplex receptacles coming after it, known as multiple-location protection. Two-wire cable runs from the gfci to all the following receptacles. The line terminals on the gfci are connected to the circuit source and the load terminals are connected with a pigtail splice to each of the following receptacles. This keeps each duplex connected directly to the gfci.