There have been several treatments of this question in literature and film that may be worth reading or watching.
E.g. there is Elie Wiesel's play "The Trial of God"(ISBN 978-0805210538):
The Trial of God (as it was held on February 25, 1649, in Shamgorod)
A Play by Elie Wiesel
Translated by Marion Wiesel
Introduction by Robert McAfee Brown
Afterword by Matthew Fox
Where is God when innocent human beings suffer? This drama lays bare the most vexing questions confronting the moral imagination.
Set in a Ukranian village in the year 1649, this haunting play takes place in the aftermath of a pogrom. Only two Jews, Berish the innkeeper and his daughter Hannah, have survived the brutal Cossack raids. When three itinerant actors arrive in town to perform a Purim play, Berish demands that they stage a mock trial of God instead, indicting Him for His silence in the face of evil. Berish, a latter-day Job, is ready to take on the role of prosecutor. But who will defend God? A mysterious stranger named Sam, who seems oddly familiar to everyone present, shows up just in time to volunteer.
The idea for this play came from an event that Elie Wiesel witnessed as a boy in Auschwitz: “Three rabbis—all erudite and pious men—decided one evening to indict God for allowing His children to be massacred. I remember: I was there, and I felt like crying. But there nobody cried.”
Inspired and challenged by this play, Christian theologians Robert McAfee Brown and Matthew Fox, in a new Introduction and Afterword, join Elie Wiesel in the search for faith in a world where God is silent.
And there is, of course, that great movie (television play) based on Wiesel's play, "God on Trial" from 2008:
Who is to blame for the greatest of all crimes? Facing extermination at Auschwitz, a group of prisoners solemnly weighs the case against God.
Following the harrowing ritual of selection for death or hard labor, a group of new inmates unsure of their appointed fates begins asking how God could allow for so much suffering. Impulsively, the men decide to put God on trial for abandoning His chosen people. Amid the sound of prisoners outside being marched to the gas chamber, the trial unfolds, addressing the age-old question: How can there be evil in a universe ruled by an all-powerful, benevolent God?
Some of the prisoners are passionate defenders of their faith, but as the hour approaches when many of them will be chosen to die, they reach a verdict. It is a surprising conclusion to this challenging and respectful proceeding.