There are a number of possibilities
By the nature of the question, I'm going to assume an incandescent bulb. Obviously, a CFL, LED or other non-incandescent technology bulb will behave rather differently and may in fact even present an open circuit. If this is not the case, some other possibilities are:
1) Corrosion between the bulb and the fixture either in the screw base or the center
2) A hairline fracture in the filament which may, when "bumped" close (I've seen this quite a bit with incandescent bulbs)
3) The soldered connection at the screw portion of the bulb's base was poor, cold, open or intermittent
4) The solder at the center conductor of the bulb's base was poor, cold, open or intermittent
5) The bulb was not screwed all the way into the fixture for some reason
6) The bulb was incompatible with the fixture, such as a 3 way bulb, etc.
7) .... and there are a whole lot more!