Where It All Goes Down
The world seemed huge to the Israelites, but compared to what we know now, their world was actually pretty tiny. To put it in perspective, Biblical writers thought that Lebanon, which was a few hundred miles north of central Israel—the distance between Washington, D.C. and Philly—was far off. Basically, the scale of everything was much smaller.
Israel had a varied landscape, with mountains, deserts, and valleys, and the Psalms, with their abundance of natural imagery, don't leave that out (107:4, 83:6-11). So it's pretty clear that most of the Psalms are set in Israel.
Can we identify these locations? Well, scholars have tried to place the names of Biblical cities (see 60:6-12), but pinning them down is often difficult. Even the Jerusalem of today is about 15 feet higher than the ancient Jerusalem because of the buildup over the millennia. Thanks a lot, time.
But there's some (unintended) tourism that leads to some serious literary development. In 586 BCE, the Babylonian Empire seized Jerusalem, razed the Temple, and sent its citizens into exile. And those heartbroken Israelites got to work, composing lamenting Psalms to get some of their weepies out. Instead of writing from their home-turf, we read Psalms written in enemy territory, that speak as though they were written in prison. Check out Psalm 137:1: "By the rivers of Babylon, there we sat and wept...How can we sing a song of the Lord on alien soil?"
Luckily for culture at large, they managed to pull a Sam Smith and channel their pain into their art. Turns out they could sing songs of the Lord on alien soil—though the songs were certainly very different than those that came before.
The Israelites, by the by, made it back to Israel in 539 BCE, older, wiser, and desperate to get things right. It's sort of like Frodo and Sam returning to the Shire: it's home, but they've been through too much to see it the same way.
Speaking of which, time is no easy topic in Psalms either. The Psalms were all written down over a period of about six hundred years, from about 1000 BCE to 400 BCE (ish! The Psalms are nearly impossible to date, and some people think they were all composed around 1000 BCE, while some scholars defend that a few Psalms date as late as 200 or 150 BCE.) Imagine if it took J.K. Rowling that long to get each Harry Potter story out.
But it's a bit trickier than that. Because they're all songs, it's possible that some psalms were in the culture long before they were written down. Before writing was common, people transmitted their stories through singing and reciting stuff together around fires at night. (No s'mores included.) So, some stories may have been written down centuries after they were imagined and composed.
Yeah, we said it was tough.
More unhelpfully, the writers didn't bother to date their work. And a lot of the Psalms deal with really timeless themes, like faith, doubt, a relationship with God, and so on.
However, it is possible to tell when a particular psalm was written based any given odd political event referenced in the text or based on themes and theological ideas that rose and fell in popularity through the ages. So, if the poem references Jerusalem as conquered, which happened in 586 BCE (see Psalm 79), we know it was written after that and is post-exilic. Conversely, if the poem isn't so sure that God is the only god around and seems to hint at a larger pantheon, it's probably an earlier, or pre-exilic, Psalm (Israel got pretty stridently monotheist after the exile).
Basically, all anyone can do is make an educated guess. A bunch of scholars today refuse to spend too much time dating the Psalms or call it an impossible task.
(But they're probably right.)