Recently, James Golick tweeted the question this post answers. I'm going into detail here because the answer is too long for a tweet, and I'm currently on a self-imposed Twitter ban (I'm not allowing myself back onto Twitter until I've written my own client which enforces my own, very idiosyncratic idea of an ideal Twitter user experience).
The most important thing to understand is that to my knowledge only one researcher has investigated this question in detail and with exclusive focus; that researcher is Mihaly Csikszentmihalyi, and he summarizes his research in the essential book Flow: The Psychology of Optimal Experience.
Csikszentmihalyi's term "flow" expresses the same essential concept as "getting in the zone." A flow state is a state where a person experiences no consciousness of anything except the task at hand. The second and third most important things to understand are 2) that regular experiences of a flow state are the consistent unifying feature of the lives of happy people, and 3) that achieving a flow state requires only two things: that the task at hand be both achievable enough to supply a reward experience of some kind within a relatively short time frame, and that the task at hand be difficult enough that success requires engrossing concentration.
When faced with tasks that are neither achievable nor challenging, flow is impossible; otherwise, all you have to do to achieve flow is segment your tasks into chunks which are both achievable and difficult.
A very important, related data point: procrastination occurs most frequently in the context of vaguely-defined tasks. Thus the same segmenting which sets you up for flow also minimizes procrastination.
It also cures depression, or at least, it did in my case. When I first learned point 2, that flow experiences are the consistent unifying feature of the lives of happy people, I immediately began to train myself on drum essentials like paradiddles. I did this because I was depressed at the time, probably suffering from clinical depression in fact. It cured me of that problem, and I had known from the research that it would. The drum techniques were both achievable and difficult, which made learning them a guarantor of flow, which made me a happy person.