Symbolism, Imagery, Allegory
God's covenant with the Israelites is like a legal agreement: God gets worshipers, his people get protection. Sounds pretty simple, right?
But here's the thing: the writers wouldn't endorse the contract so much if it were a given that everyone was faithful. Would you put up a "no smoking" sign where people never smoke? No. And sure enough, not everyone is faithful.
Much of Psalms is worried about what happens when God or the people don't do their part. What happens when God stops showing up? What happens when the people stop following God's law? Let's put it this way: it's not pretty.