I actually have a theory on why God created life.
Throughout the Bible, God has murdered many, many people, and all of these people either didn't follow him, or did things he found wrong. Not once did God murder someone devoted to him. There has been instances where someone who didn't follow God started following God, and THEN the Bible started portraying him in a positive light. There has also been instances where someone who followed God stopped, and the Bible then started portraying them in a negative light. From this, you can conclude that God's purpose of life is to be worshiped.
Now, God created the angels and that was his source of worship. The angels existed for a loooong, long time before God created humans. But if God had his worship from angels, why did he make humans? Well, this ties into why God would create the angel who became Satan and allow sin to exist, despite knowing that both would cause strife for mankind. In fact, I think God allowed these to exist BECAUSE he knew it would cause strife for mankind. See, God created the angels too strong. As shown with Satan, the angels could rebel and, without interference from God, they could survive forever and ever. Angels don't, per se, NEED God.
So God created humans. He made humans vastly inferior to angels, he made them weak, weak enough so that they WOULD need God. But he couldn't just make them imperfect, no, that won't be very loving. He made them perfect. But, that was no problem. God KNEW Satan would trick the first humans and render humans imperfect. This would render humans mortal, and amidst natural disasters and other nefarious humans, need protection, salvation, hope. They'd NEED God. This is why, despite displaying himself as all-loving and having humans' best interest at heart, God has allowed us to suffer under Satan, disaster, sin and death.
It's all to ensure he is worshipped.