American literature to me seems very pessimistic, but how can someone argue that there are messages of hope and optimism in these texts?
You do have a point in what you say about Modern Classic American Literature. Indeed, no serious literature of the same period overtly conveys hopes and optimism.
However, if you look at works such as Death of a Salesman and Great Gatsby, for example, you will see that their authors -Miller and Fitgerald respectively- are trying to awaken the reader/spectator from the mesmerizing effect of the so-called American Dream.
The American Dream, i.e. that every American would have her fair share of freedom of choice, equality of opportunity and, eventually, material success was and perhaps still is a philosophy of life, an ideal to live by, but no more than a dream.
The tragedy that these authors and others vividly depicted was the inconsistency between the dream and reality. In a systematic way, the main characters of these and other works did everything by the book to fail at some point of their pursuit.
Viewed thus, the message of hope is that the average American will open her eyes to social and economic injustice, discrimination of all sorts, and political manipulation to live and choose freely. In fact, in many of these works (All My Sons by Miller is but one example) there is at least one character that attains real freedom of choice through acknowledgment of the truth.
I would say that this is the kind of hope to be found in such works: that the dream may dispel and stop causing the downfall of those who cannot see it for what it is.