Schedule, time-constraints, how long it takes to complete a project with a deadline at X, Fixing something that has just crashed/security issues.
It's like school. Some stay up late to study, others to finish 90% of their projects/homework.
you programm at night because you want to complete your (piece of) code. I think there are two main reaseons:
1) For me is time management a very hard task in programming. Because you dont know how long it will take to solve some unexpected problem. Because if there is a difficult problem you sometimes find a solution in a forum or book but sometimes you have to restructure your complete code.
2) You hop from one idea to the other. You think: I could include this and this and this function and then 1) occurs