So this used to happen to me when my phone worked all they way. I'd be at a hockey practice, come back to the locker room, and it'd be completely off.
Sometimes they do this when they get too hot or cold.
Now that my home screen button is broken, it happened again. My friend told me it shouldn't matter if the button is broken, holding down the power and home buttons should work. And it did.
It happened again today and i sat from a good five minutes waiting for the apple logo to appear, but my phone is back on.
If the apple logo comes on and back off, put it on the charger. That worked this time.