Rumour has it that the B vitamins set your mind going, so it squares with people getting restless nights.
I take mine in the morning, so I can "make the most of my day", just like it says on the packet!
However, if I've been drinking heavily and my health-guilt complex shines through, I knock one back before bed to fend off the worst excesses of the hangover. Works too.