What keeps me motivated is I like writing for its own sake, it is my hobby, it can make me laugh, it makes me feel good to have figured things out, and for crafting a piece of art. Like other people's non-passive hobbies (painting, woodworking, car restoration, writing music) it is an outlet for my imagination. It gives me something to think about that isn't my daily work. I read books on writing when traveling, and articles on writing a few times a week.
And I devote a few hours to writing every day, at the same time, when I get up and can write my best, a few hours before I have to go to work.
Stephen King, in a live interview I watched, was asked by the interviewer what advice he had for people that wanted to write. His answer: "Write!"
He went on to say (I paraphrase, this was at least twenty years ago) that most people that claim they want to write, only want to have written. They want the money, they want the fame, they want to do talk shows and be interviewed on TV. But they don't love to write, or they would just write. He said, he loves writing, and he writes every single day, for the sake of writing. He did that for years before he sold even a short story.
Many people read as a hobby, or watch fiction on TV. They aren't trying to monetize this hobby and turn it into a job (critic, agent, publisher, producer); they don't hope to become famous by reading or watching TV.
I would say the motivation is to treat writing as a hobby and something you have fun doing, and look forward to doing. Like other hobbies, it shouldn't matter to you if you ever make a dime out of it. The possibility is there, but if you focus on the money you will quickly give up, because the "hourly rates" for the vast majority of first published novels is pennies per hour. Like, $3000 for over a year's worth work, if you get it published. A super-majority of self-published books earn less than $100; which is probably family and friend purchases anyway.
If you don't actually enjoy writing and crafting pieces, then I'd say find another hobby. Don't be fooled into thinking you will get rich if you just keep slogging away at it, I truly do not think it is possible for somebody that doesn't enjoy writing to get rich writing. If you DO enjoy writing, then set aside time for it and do it as a hobby. I am not saying rule out publishing, but leave it for when you know you have finished something you really love and think people will like, then teach yourself to query and get an agent while you continue your hobby of writing every day.