1) God created freewill; it's what makes life interesting not only for us, but also for him. If you knew how your children would react to every situation because they were preprogramed to make the right decisions and to love you, how enjoyable would that be? If our decisions didn't come with some risks, if there wasn't any wonder about the outcomes, would life be worth living?
2) If God weren't righteous and just, he would fix everything all the time and freewill would've been unnecessary; it would've been a mistake for him to create it. God's not known for making mistakes.
3) God punishes us for doing the wrong things because he's our Father. Some people say a loving God wouldn't do this but aren't you a loving parent when you discipline your children in order to correct their behaviors and spare them pain down the road from making bad choices? I also believe that many times people think God is punishing them, when he isn't. He doesn't always have to punish us because freewill takes care of it for him as we sometimes reap what we sow. I thank God I haven't always had to reap what I've sown. It's during these times when I selfishly spend a lot of time during my prayers asking him to intervene so that I don't reap the consequences of my idiotic choices.
4) Anytime we talk about God and question different things like why he does what he does, it's futile because our minds can't comprehend him. The Bible gives us great insight but sometimes it's like the U.S. Constitution in that biblical scholars can disagree about various verses. That fact is, trying to understand God completely, is like trying to count the number of universes in existence. At some point scientists must project their count because they can no longer see them visually. It's a guess, it's not scientific certainty.
The Christian singer Chris Rice wrote an awesome song called: "Questions for Heaven." He's right, there are so many questions we'll never have answers to down here, but someday, and I can't wait, we will.