First of all, prayer is much more than just petitioning God or asking Him to do things. Instead, it is both an opportunity to build a relationship with the God of creation, and also an outpouring of that relationship.
In Jesus's model prayer, known as the Lord's prayer, found in Matthew 6 and Luke 11, Jesus both begins and ends by praising the Father. He states His complete commitment to Him and dependence upon Him. Praise is an extremely important aspect of prayer and has absolutely nothing to do with petition. How can we speak to the Father without acknowledging His status?
Thanksgiving is another common element in prayer (Philippians 4:6; Psalm 69, 95, 100, etc). For me personally, almost every single prayer I pray involves thanksgiving, but not every one of my prayers involves asking God to do something for me or trying to change His mind about something.
We also see confession in the Lord's prayer... not that Christ was confessing sins (Hebrews 4:15 informs us that He was sinless and perfect), but rather that He taught us to do so. How can we come before the throne of God without admitting our wrongs to Him and asking for forgiveness?
Here, we see a glimpse into a specific type of petition: asking God for forgiveness.
Why do we ask God for this? We ask Him for forgiveness because He tells us that if we confess our sins, He is faithful and just to forgive us our sins and to cleanse us from all unrighteousness (1 John 1:9).
Will He forgive us and cleanse us if we do not confess and ask Him for that forgiveness? The short answer is no, He will not.
But doesn't God already know what we've done? Why must we confess?
When phrased like this, the question at hand almost seems silly. Of course God knows what we've done. We tell Him about it not because He doesn't know, but rather because a repentant heart and a genuine sorrow for our sins moves us to confess.
Confessions in prayer (and all proper forms of prayerful petition) are acts of acknowledged dependence. These petitions are the outpouring of a heart that is right (or truly wants to be right) before God. They are not an attempt to change His mind, but rather an acknowledgement that He is Sovereign Lord.
Petition in prayer is not about informing God of something He does not already know, and it is a false dichotomy to suggest that either *He must not know* or else *there is no point in talking to Him*. It is also not about changing His mind. Instead, it is both an opportunity to build a relationship with the God of creation, and also an outpouring of that relationship.