The Psalmist goes from a sigh to a song and he gives us the key to do the same. The desperation in the first half of this Psalm is palpable. The Psalmist feels abandoned, forgotten, and alone. He is desperate for God's presence but He is nowhere to be found.
In a moment of doubt, the Psalmist resigns himself to the fact that this may be his fate; he is abandoned by God. But just then, at his lowest point, he remembers. He recalls all of the wonderful works of god in the past. He begins to name them. The whole tone of the Psalm changed from a sigh to a song and it hinges on remembering. That is the key!
[Lam 3:21-23 KJV] 21 This I recall to my mind, therefore have I hope. 22 It is of the LORD'S mercies that we are not consumed, because his compassions fail not. 23 They are new every morning: great is thy faithfulness.