I believe that prayer works in exactly the same way as The Samaritans - I was a volunteer for three years.
Chad Varah who formed the organisation, used to make himself available to listen to parishioners' problems, and he asked a couple of ladies to make tea and chat to those waiting to see him.
Eventually he discovered that the waiters didn't need him, they had chatted with the volunteers and got their issues aired, and went home happy.
That was the basis of the Samaritans' philosophy - if you give someone a chance to speak out loud, put their thoughts in order when they are spinning around inside, it helps people to see things more clearly.
I believe prayer works in exactly the same way.