In the book of Job, we find questions about God's justice and why good people suffer. No answers are given, but God reminds us to trust His wisdom and character.
Throughout the book, Job, his wife, and his friends speculate on why he, an upright man, suffers. Job accuses God of being unjust and not operating the world according to principles of justice, and his friends believe that Job's sin caused his suffering. Job decides to talk directly to God.
God reminds him that the world has order and beauty but is also wild and dangerous. While we do not always know why we suffer, we can bring our pain and grief to God and trust that He is wise and knows what He's doing.