Why would my ceiling light only work half the time?
If it is a recessed Fixture there can be a thermal overload protector in it. It is towards the top of the fixture and looks something like this. It could be that the Fixture is too hot and the inrush current through the protector is too much and its tripping the protector.   Is it an Incandescent Bulb?    Swap it out with a LED and see if it does the same thing.   You can buy replacement protectors too.