The bible makes us to understand that God wants peace and He doesn't like evil to happen. God gave human beings free will, bad things can happen as a result of human choices, the broken condition of the world, and the consequences of sin. While God may allow difficult circumstances, His desire is often to bring spiritual growth, repentance, and a deeper trust in Him through those experiences.
The Bible also shows that God can bring good out of painful situations. When we face problems God cares and remain compassionate with us. Rather than abandoning His people in times of trouble, He offers strength, comfort, and hope, working all things according to His greater purpose and wisdom.