Exodus 4:21The Lord instructed Moses, When you go back to Egypt, make sure you do in front of Pharaoh all the wonders I have put within your power. But I will harden his heart so that he won't let the people go.
Why would God harden his heart if he wants pharaoh to let his people go in the first place? Yes, I know it goes on to say God hardens their hearts in order that he may show these signs among them and that they may know it is God. I'm just baffled.
__________________
Lamentation 3:24 The Lord is all I have, and so in him I put my hope.
God did this to show Moses that Pharaoh wasn't going to let the Hebrew children go no matter what Moses said. God did this (and continues to do this today to unrepentant sinners, see Rom. 1:18-32) by letting Pharaoh do what he wanted, thinking that he would keep the Hebrews as slaves (note how halfway into the plagues Pharaoh tried to "bargain" with Moses by saying that they could go, but keep their women and children in Egypt, then asked to keep their livestock for them, knowing that they would have to come back for both of them). Trying to "bargain with God" about something that He wants us to do, but we refuse to, like wanting us to let go of a particular sin that He wants gone from our lives results in grieving the Holy Spirit, which stifles our love for Him, makes our witness less effective, and can lead to even greater acts of disobedience. No matter what bad thing happened to his people, Pharaoh wasn't going to give in to God's demands for the freedom for His children. Like in any other addiction, you can "sell your soul" for political power. And, just like with a "junkie", the end results will be a person losing his mind trying to grab for every little bit of it.
Most of the reasons have already been covered. I can't remember the verse at the moment, but I got the impression that it was a punishment on Pharaoh for the way he had treated God's people.
Also the plagues tend to be related to one or several of Egypt's gods, making fun of their power and demonstrating that YHWH is the one and only true God.