I just recently installed a ceiling fan in a spare bedroom. I returned power to the house and flipped the switch on... nothing.

The previous switch was an old turnable dimmer from the 70s (I'm guessing). I am definitely confused because the back of the old switch had 2 black wires. In addition, there are 3 white wires and 3 black wires behind the wall. When the old switch was removed, one of the wires from the switch was joined to one black wire from the wall and the other wire from the switch was joined to the remaining 2 black wires. The 3 white wires were all joined together and tucked away in the back.

There is only 1 black and 1 white wire coming out of the ceiling which is hooked up to the fan.

I have replaced the switch with a new one (no dimmer). Why are there so many wires behind the switch and how do i get power to the ceiling fan?

Please help!