This is a tough book to get through, isn't it? I had to take breaks it was so depressing. But the hopeful note at the end of the story, after I thought about it a while, suggests to me or represents that the struggle for humanity, and the overwhelming and driving will human beings have for survival carries on, even after the story is done.
McCarthy waits until the last few pages of the book to suggest that there are, after all, others like the man and his son, who have chosen to collect themselves and their families, protect them, and hold on to what makes them humans and not mere animals. They are starting again, and the boy becomes a part of that at the end.
I think the line towards the end of the book about the man who takes the boy in after his father's death is especially telling. The man who comes to retrieve the boy suggests that there was considerable debate between the survivors he is with about whether to come get the boy or not. And obviously the final decision is to rescue him. This unselfish act, this most important of human gestures--saving a life--is a hopeful ending on more levels than just the rescue itself.
The hopelessness comes in that the struggle isn't finished, and the odds are long for humanity in general. Nothing is "fixed" at the end, and we see no capacity for mankind to truly recover in the long term, but there is still hope that it can and will at some future point.