I have a question. Judaism teaches us that all that happens is by Hashem and that it is all good. Further, everything that happens to us is for our good although it may be difficult to recognize the goodness at times.
Judaism also teaches us to pray, that prayer is effective. However, when we pray, we are often asking or petitioning Hashem for change. We may be asking for healing, love, and so on. Does this undermine our faith in Hashem that what happens to us is for our good? How is prayer reconciled with the first paragraph above?
By praying, you change yourself. Thus, God's "decision" about what is good for you changes. It now becomes good, for example, for Bob to have a child, or to have health, or money or whatever, whereas before, it was good for him not to have those things.
Why change from one good to another? There are different levels of good. For some people, chemotherapy might be good. But being healthy is a better good.
Bad times can prompt a person to pray and develop a greater awareness of, and relationship to, God. Imagine a mother of two teenage daughters. The mother senses that the older daughter will benefit greatly from a close relationship to the mother, while the younger daughter will benefit from more "space." What does she do? To the younger daughter she gives a car, a credit card and a gas card, and to the older daughter she gives none of these. Which daughter do you think she will end up spending more time with?