It's pretty rare that I need to force myself awake. My brother frequently had to pull all-nighters to get through architecture school. One of his tricks was too slowly nurse a 5 hour energy throughout the night.
Those sorts of drinks do help prevent you from falling asleep on a physical level, but you'll still feel exhausted and mentally you might still check out. I did it once when I had work/school conflict and was forced to work from like 1am to 6am so that I could attend class without screwing over my workplace.
If it's a short term sort of thing, generally I try to sit in a less comfortable way, prevent myself from getting too comfortably warm, or periodically pinch myself to prevent myself from nodding off