Famous Extra Wire In Ceiling Light Box References. They are just taking power from that box. At the light fixture box, the black wire is spliced with the black wire running to the switch.
In the ceiling box where the fan is installed, there are: At the switch, the black wire is connected to the new switch. They are just taking power from that box.

