The Mesopotamians never defined “prayer,” though they had a number of words that we translate with the term (e.g., Akkadian supû, teslītu, and ikribu).
A preliminary definition of prayer (as found in texts) might run something like this: when a text records an appeal to some supra-human, benevolent being who is presumed to be powerful enough to assist in granting the appeal.
Complaint is another common feature in prayers. One particularly poignantly example complains “(My) life has become like that (of someone) beaten with wooden poles.” Supplicants often voice their woes, laments, and confessions to the being to whom they are appealing. Sometimes these occur during but also after the expression of praise. Complaints may also be interlaced with the supplicant’s petitions, yet another common feature in Akkadian prayers.
The ancient Mesopotamians prayed for the same general reason people pray today: they needed something that the gods could supply. This might be a response to a query, forgiveness for a sin, the restoration of health, renewed prosperity, help against an enemy, or deliverance from the threat of an announced evil (in the form of an ominous sign), among other things. Ritual officials assisted supplicants in making petitions by providing the proper, pre-formulated ritual to enact that included the prayer to recite (e.g., a shaziga for sexual impotence, a namburbi to turn away the announced evil of an ominous sign, or a dingirshadabba for the quelling of the wrath of a personal deity). Occasionally, a ritual instructs a person to speak from their heart, which seems to be a reference to extemporaneous prayer.