if it's a QR, it wasn't tight enough. if it's a bolt on, it wasn't tight enough.
most likely it was because you didn't put it on tight enough, but it's possible some of the threads are stripping or there is another similar equipment failure. it could have also vibrated loose. somebody could've ****ed with it. keep it tight and you most likely wont have any problems.