Not everyone suffers from insomnia, but for those of us who do, I've found spending time with my dogs to be therapeutic at 2am.
If you’re up in the middle of the night because you cannot get to sleep, you might as well work in fifteen minutes of training. Of course, I am assuming that your dog has woken up with you. I'm sure there are dogs out there who sleep through the night, especially if they're in a kennel. But Bernie and Lizzie spend their nights in bed with us, so every time we're up, they get up.
Maybe you're up for a quick snack or a trip to the bathroom. You can work in one training expectation.
I've got Matthew on board with this middle-of-the-night training expectation. He works overnights, so on his days off, he will frequently wake up in the middle of the night. If he gets up for a snack, he shares with the pups, but he knows that he should be requiring some behavior from them.
Currently, he's working with Lizzie on a real down. She likes to try to fake Matthew out, so he's raising his level of expectations from her. With Bernie, he requires a greet/paw/shake to help desensitize Bernie for his CGC test.
Even though the midnight snack takes seconds only, the pups know that any time Matthew wakes up to grab a bite, they'll be expected to do something.