Even though each psalm stands alone as an individual song, they are grouped loosely by themes. Originally the psalms would have been recorded on scrolls and obviously they could only be so long and still be practical to use. Therefore the book of Psalms may have been divided for practicality as much as for any other reason.
Psalms is divided into five books by the man (possibly Ezra) or group who compiled them.
Book 1 – Psalm 1-41: These first psalms are considered prayers of David. All forty psalms are attributed to him. Obviously the most notable of this group is Psalm 23.
Book 2 – Psalm 42-72: The theme of these psalms might be the suffering of the righteous and their deliverance from suffering.
Book 3 – Psalm 73-89: These psalms are concerned with how God deals with Israel, particularly as the people slide away from the Lord.
Book 4 – Psalm 90-106: These psalms also deal with suffering but rather than deliverance, the focus is on the reign of God. While book 2 looks at an earthly deliverance, in book 4 we are reminded that not all suffering will be ended on earth but because God is still in control there will be justice in God’s eternal kingdom.
Book 5 – Psalm 107-150: This final section focuses on the law of God. It not only contains the longest psalm, Psalm 119, but the last five psalms are known as the Hallel or Hallelujah Psalms. Each of these psalms begins and ends with the words “praise the Lord.”