the sockets do go bad. look inside for a broken metal clip in the bottom.

also unplug the head light, clean the socket and plug, work it on and off a few times, see if it works.