I also stayed up until 1-2am, regularly, starting around junior high. I performed a great many tasks, mostly teaching myself various programming languages, always at the relative expense of my concentration in the next day's classes. Two things were the primary motivating factors in developing this habit:
- My parents wouldn't leave me alone for very long in the evenings, so I felt like I wouldn't get a chance to really concentrate until they were off to bed
- My brain gets tired around 10pm like a normal person, but then it gets a "second wind" and is up happily until 3-4am, with intensely increased clarity of focus.
The first trait was obviously correctable and probably circumstantial, but the second feels far more innate. I just focus better right after the sun goes down, and I'm not really sure why. It's like all the stress from the day melts away, and I get a chance to finally be myself for a few hours. So, I work an evening shift (my work day starts at noon and gets out quite late) and I couldn't be happier for it.
It's a shame that this combination is both common, and regarded as lazy by society at large, because it seems to be quite the opposite. I get my best work done in the evenings, and so do lots of other people. I wish that we were generally more accepting of these traits, because if I hadn't had the good fortune to stumble into a job with such a well-aligned shift, I would still be struggling to sleep properly most nights.