How do I troubleshoot an intermittent problem with a ceiling light/fan?
After 30 years as an electrician, most 95% of all electrical problems I've seen are caused by poor connections. 

The best connection for outlets (receptacles) is to pigtail the wires by first twisting the white (neutrals) together and the blacks (hot) with a separate wire for each going to the terminal screws on the receptacle. Torque the connection sufficiently to avoid a high resistance connection, which will generate heat under load. 

Many less skilled workmen insert wires into the back of a receptacle, and over time they work their way back out or open up because of high resistance. 

Make sure the power is off or consult an electrician.