Start by detaching the fan from the ceiling and take it apart to paint it. Turn off power to the fan at the circuit breaker or fuse. Verify that power is off on the circuit by using a circuit tester. Only then is it safe to remove the fan and touch the wiring. Use a stepladder to safely reach the fan.
Make sure the circuit is truly "dead" before touching any wires or terminals. Check with a high-voltage neon tester after you have detached the fan motor assembly from the ceiling. Test from the black wires to a grounded metal box or other good ground, then to the white wires. Also, test from the white wires to a ground. Be sure your tester is functioning by first trying it in a live receptacle
Enlist an assistant to help you with removing the fan from the ceiling.
Before detaching the fan from the ceiling, remove the light kit, if your fan has one. This will help ensure you don’t break any fragile shades or bulbs. Remove the light shades by either unscrewing their screws with a screwdriver or by undoing the thumbscrews, depending on the model of fan. Take the bulbs from their sockets.
Now detach the fan from the ceiling. Slide the ceiling cover down and then unscrew the screws holding the motor assembly to the hanger bracket in the ceiling. Now you should be able to access the wiring. Untwist the wire connectors for each wire connection while your assistant holds the fan. Then disconnect the fan wires from the junction box wiring. Come down from the ladder and set the fan on a worktable to continue your project.