Physical and mental training helps. Like Jason said, the energy of the investigation keeps you awake and like crystalcross said, the next day is hell!! If you stay fully engaged in the investigation it is pretty easy to stay awake.
Another thing you will want to try to do is to adjust your schedule to the investigation a day ahead or so to be able to be more alert during the late hours whenever possible.
Obviously as the hours go more into the morning the investigators usually become a bit more giddy. But you can reduce that by just getting your body acclimated to it a bit for a day or so. Of course the day after is hell when you have to adjust back.
That's all compounded by the fact that in many cases you'll have driven all day just to get to the location.
What tricks do you use to keep yourself awake for an investigation? Do you eat candy or use energy drinks. Or is it that the place is just keeping you on your toes! I've always been curious.