“How to stay motivated” is probably the most over-served content on the Internet.
That being said, nuggets of wisdom are available. The best and most useful advice I have found and read in this area is the Goldilocks Rule.
When you play basketball (or another sport) with a bunch of small kids you’ll most likely be scoring all the points. You’ll soon lose motivation to play because the competition is nowhere near you.
On the other hand, if you’re playing with professional players, you’ll continuingly keep losing games, because the competition is too tough. You will be easily unmotivated and depressed.
Whereas, when you play with someone who is equal, or just a bit more skilled than you, you’re more likely to keep playing, as you’ll be winning some and losing some.
Since your mind knows you have a good chance of winning—it will try to focus more and play a bit harder to compete and win.
When you play at the edge of your own skill level you’ll find all the motivation you need. That’s the Goldilocks Rule.
Here it is again:
The Goldilocks Rule states that humans experience peak motivation when working on tasks that are right on the edge of their current abilities. Not too hard. Not too easy. Just right.