For me, it's a mix of passion, potential business, and call of duty (if I may say it like this).
I started working on this open-source project three years ago. I needed a tool like this, but also, I wanted to learn aside from my day job.
The project has been growing since then, and now, I know that I can create a business around it.
I also get a lot of support or feature requests. So I kind of feel like I have to continue working on it (that's the "duty" part :) ).
Finally, I am very passionate about development, which helps a lot.
These are probably the three things that motivate me to work on this project.
Still, having a family with two kids, working during the evenings is not easy at all. What I tried was to set realistic, small goals. One feature at a time, one task after the other. Not trying to overdo it (most of the time).
I also know that having only one to two productive hours in the evening, I need to be extra focused and avoid phony work. I try to ask myself "why?", for each task. What is my goal? How does doing this specific task serves it? Thus, I manage to avoid working on useless things or procrastinating. With more or less success.
Having said all this, I still nearly burned out last September. Next month I will go full time on the project. It's a big bet, and it's partly about reclaiming my sanity and my free time.
So, your question is definitely not an easy one to answer!
(My side project: https://mockoon.com)