Doubt and despair can make people feel like whatever they try is futile, and a negative outcome is already predetermined. Optimism gives them hope that they have some free will and that they have some power to change their circumstances for the better.