The Bible says that no prophet emerged from Israel like Moses. He knew God face-to-face, and indeed he was called a "friend of God". This is high praise for somebody who spent his first 40 years as a nobody.
But how did Moses become a somebody?
He did it through trial and error, through his failures and God's forgiveness. The Lord refined and remade Moses by giving him many "second chances".
God works in our lives the same way, He's still giving away "second chances". The Lord wants to remake us. His goal for us is not a trouble-free life or a prosperous existence. God's goal is transformation, change from the basic raw product to a faithful, obedient, and refined disciple of Jesus Christ.
Such transformation takes time. It takes buffing. It requires abrasives. Sometimes it's painful. But God knows just what it takes to get us there. He did it with Moses, and He can do it with us. What we need in the midst of life's baffling and bewildering experience is not an explanation, but just a deeper understanding of The God of Second Chances.