This Psalm is a prayer concerning the destruction of Jerusalem and the fallen dynasty of David. The Psalmist is trying to make sense of it. He knows that God promised that David's line would remain forever and that his descendants would sit on the throne. As things were, it appeared unlikely to come to pass.
Israel was being punished for her sins and the promise seemed to be dead and buried. What the Psalmist doesn't know, even though his recorded prayer prophesies it, is that God would keep His promise through Jesus Christ, who was of the line of David and whose Kingdom will have no end.