The short answer is : you don’t. There is no such thing as “staying” motivated. Instead you need to cultivate necessity.
Necessity
You know this feeling you get when you’re getting dangerously close to a deadline. Like you have to get that shit done. Now. Err.. actually yesterday, but yeah, now. And you get full power into your essay/project/report. That feel like motivation, right? So now the question is more how do I stay motivated all the time? Not just when I get close to a deadline, but when I want to.
Think about it for a moment, the high pressure coming from a danger (missed deadline) is a high necessity. So you need it and you do it.
To get wired on your goals, and achieve what you want in life, you have to need these goals in the first place.
You are like “I would like to want to get my degree, but instead I’ll just chill today” You want results but not as hard as you wanna chill.
So, first change your source of information, what you watch, what you read, until you become something else.
To be somewhere, you have to be someone else, so become someone else.
Because we are wired to do just what we need to do, get to the point where you need to achieve your goal.