"The best way is always to stop when you are going good and when you know what will happen next. If you do that every day … you will never be stuck. Always stop while you are going good and don’t think about it or worry about it until you start to write the next day. That way your subconscious will work on it all the time. But if you think about it consciously or worry about it you will kill it and your brain will be tired before you start."
I often create fun little mini-projects for myself to do and store them for later. I find that completing a small and fun project motivates me to work on whatever actual task I should be working on.