Prayer is normally understood as a request to God, asking for something. But it can also be seen as a mental discipline, reminding myself of God and God's will for me. Wikipedia has an article on both understandings covering many religious traditions.
The Serenity Prayer
The "Serenity Prayer" is actually the first part of a prayer by Reinhold Niebuhr. For the complete serenity prayer and some background, see this site.
"God grant me the serenity to accept the things I cannot change, courage to change the things I can, and the wisdom to know the difference."
This favorite tool in the toolkit cuts my problems in two. Either I can do something about the problem right now or I can't. If I am in a position to do something, I should probably do it. If there is nothing more that I can do, I need to accept the situation as it is.
This does not mean that I permanently accept a situation which is wrong or otherwise unacceptable, change may be necessary. But if there is nothing I can do right now, for my own peace of mind - serenity - I need to accept what is. I also remember that I am praying for the wisdom to know the difference, what is God's will for me?
Finally, I am praying for these things (the serenity, courage and wisdom) because I don't have them. I'm asking God to provide them.
Simply making a list of things I am grateful for helps to turn my mind to positive things.