Richard is right on target with the 2x4 support tied to the ceiling joists. With a junction box nailed to the 2x4 and just poking through the ceiling, flush with the ceiling.
We don’t have any ceiling fans in our house. Most days we have enough sea breeze to keep the house pleasant. When we don’t, usually in September, we’ll run the A/C when we’re uncomfortable.