Optimism isn't thinking that "everything will be in my favour". Optimism is thinking that "I will be fine even if it doesn't".
In life things do not always go your way but one must be confident in themselves to realise that they have the strength to cope with it. It's about putting a positive twist to every situation and seeing the good things that came out of it.
Everything in life has two faces to itself just like a coin and often you will only see what you have been taught/learnt to see since you were a child. Opening up your mind to the broader perspective ("the bigger picture") actually shows that everything has its pros and cons and in reality every pro and every con is simply a perspective you choose to view the fact in. Accepting a negative experience as a positive lesson and understanding that hope only exists if you choose to let it is the real meaning of optimism.
Whenever you are faced with a tough situation, you tell yourself a story (sometimes an excuse and sometimes a motivation) and it can be whatever you want it to be and although objectively the situation has not changed, the feeling/the attitude you have towards the situation changes based on the story you tell yourself. I consider my life as "busy but fun" but I could take it as "busy and stressful". The stark difference in meaning can change your attitude so much so that it starts impacting other aspects of your life. Therefore always look at the brighter side of life as only days with rain bring out the rainbow.