Any bicycle headlamp or tail light that is fastened to the bar mount with a clip can fall off. I had to back track in car traffic to retrieve batteries when I hit a pothole.
Now they are secured with additional elastic bands that have their own hooks.
As for flashlights, mount them on your helmet. Your body makes for an excellent shock absorber and the beam will point to wherever you're head is turned (instead of where your handlebar is turned).