My favorite way to stay motivated is to realize that no matter what I'm trying to do, I always could do it better, so stressing about not making mistakes only adds stress on top of the mistakes I will inevitably make. Second, I think of the process of accomplishing goals as a goal itself- I.e. Instead of only looking forward to the outcome I try to focus on how I'm getting it done- it's more fun and challenging that way, ^So it's not such a big deal if I fail to achieve the goal because I was able to enjoy the process, and I know that the next time I will be able to perform better. Third, and finally, I try to look at what I'm getting out of each situation even if I'm doing something for someone else, I try not to think about what other people have or don't have in comparison to me because I don't know what it's like to be somebody else and I never will, so I don't try to imagine it (imagination and reality seldom match up, and you're left feeling let down when there was no reason to expect more out of any particular circumstance).
Remembering these things prevents a lot of discouragement for me, and encourages me to pursue my goals.