I think it's one of life's greatest lessons and consequently one of its hardest because life's not easy. I once heard this quote, "life's a bitch because if it were easy, it'd be called a slut." I think for most people optimism is a learned characteristic. It's rare for someone to be born with a high level of it. I think you need to experience life in order to truly understand optimism. For years I did not realize that I was not optimistic. I never checked that characteristic and slowly it crept into my everyday life. I was approaching each day expecting the worst (literally from the time I woke up and was reading emails). That's a horrible way to live your life. Towards the end of that period, my girlfriend dumped me and my work life was progressively getting worse. I'd never been so downtrodden before in my life but then something magical happened, I hit rock bottom. I had run out of energy, time, and life to live like that. Now I couldn't do anything but be optimistic. There is something truly powerful to waking up and wanting to embrace the day. By smiling and being happy, you are projecting good energy out into the world. The world then recognizes that and reciprocates (sometimes when you least expect it). I embrace a yoga tip for concentrating, and I do that when I feel myself mentally going in the wrong direction. I focus on an object (for me it's an elephant standing on a barrel) and tell myself this will all work out, there's nothing I can do now, to just let the world take it's course. If something doesn't work out when you wanted it to, that doesn't mean it's not going to work out when it's supposed to. In fact, I feel like optimism is really just about staying calm and smiling in the face of adversity. My Dad also taught me a quick trick that I will end with, "always remember the 90/10 rule." Don't let the 10% of things you don't have control of, affect the 90% of things that you can control.
Since I've changed to being more optimistic I've had more wins than losses, and even in the losses I learned something so in reality it was a win. I found the biggest thing that help me though was in the language I used. When describing an event or situation I would see the positive but pick out the negative, however, now I am able to see the negative but pick out the positive. I also talk to therapist once a week as well as listen to Lewis Howes's podcast on iTunes. Best of luck!