The structure of giving thanks on a regular basis, even in hard times, encourages us to focus on the positive side of life.
It does not mean that we forget the dark side, just that we keep a true perspective, giving the positive side its due.
Sorrow and anxiety should not extinguish our ability to say "thank you" for our blessings, even when they are obscured by pain.
Harder times can shake us from complacency and may enhance in us the ability to perceive the good as a gift to be appreciated and acknowledged – in good times and in bad.
In the end, feeling and expressing gratitude is good for us.
The Almighty does not "need" our thanksgiving. It is we who benefit from feeling and expressing it.
Our Jewish liturgy contains a seldom-noticed prayer, hidden within a prayer, which acknowledges this.
The phrase appears at a high point in the service, yet it is said to oneself: "We thank You for inspiring us to thank You."
This goes well beyond being thankful for our objective gifts.
It is a recognition that even the ability to know that we should be grateful is a gift from God and worthy of thanks.
–Rabbi Adin Steinsaltz
From an essay by Rabbi Adin Steinsaltz