In order to research the difference optimism, it must be defined in a measurable manner. One of the ways that some researchers measure it is by explanatory style. For them optimism is based on how much credit you take for success, and how much you blame failure on external events. According to Cathy McFarland and Michael Ross, people with higher self-esteem, which often accompanies optimism, tend to use self-serving attribution. In other words if they fail, it was because the task was too hard. If they succeed it was because of their own talent, intelligence, and hard work. This pair of researchers from the University of Waterloo did a study to see how much this self-serving attribution affected moods. Indeed, the people who were led to believe that success or failure was based on themselves were happier when they succeeded and more glum when they failed. Those that attributed success or failure to the difficulty of the task did not have such mood swings.
So optimism, as measured by how you explain successes and failures, should go hand in hand with happiness. Well maybe this is true for a short experiment, but not when optimism is measured over a lifetime. A study of optimism in German adults from 18 to 60+ found that the younger adults had the sunniest outlooks and expected their life to improve the most. Middle age adults were a bit more realistic, and older adults predicted the greatest decline in their satisfaction with life. However, a study from the University of Chicago that looked at depth at who was happiest in America found that older people were. 
Now possibly the difference between living in Germany and America could affect the outcome of this research. However, both studies looked at huge samples of the population, groups over 1000 in size. Each study was based on the answers to a few questions, a simple rating of happiness or prediction of future satisfaction with life. So now the researchers are busy trying to explain why increasing in age results in both a more pessimistic outlook and increased happiness. Some ideas are that as people age they gain better social integration skills, they have learned to be content with who they are or perhaps their memories just gloss over past pains. So is the true cause of happiness high self-esteem or forgetfulness? Perhaps the secret to being happy really is to expect less.