The nusach of Yizkor, is שוכן הרחמים אב מרומים, "Compassionate Father Who dwells in heaven." Also, at a levayah, people say ל-א מרומים שוכן רחמים מלא, "Hashem Who is full of compassion and dwells in heaven."
Why do we mention in these tefillos that Hashem dwells in heaven? It is because we are saying, "In this world, Hashem's ways might not appear like רחמים, compassionate, but Hashem dwells in heaven, and from that vantage point, it is clear and evident that everything is compassion and for the good.
Moshe Rabbeinu asked Hashem to explain to him why there are tzaddikim who suffer and resha'im who prosper (see Brachos 7.) Hashem responded (Shemos 33) אתי מקום הנה, "There is a place near Me..." Hashem was telling Moshe that if you will come to My place, in heaven, you will understand, and you will see that everything is for the good.
It can be compared to a person on an airplane. From up there in heaven, he sees so much further than a person looking from down on earth. Hashem told Moshe to come to heaven and understand how everything is compassion and just.
The Chofetz Chaim said that this is the reason an ehrlicher Yid is often called a "hechere Yid," a high Yid. It can be compared to a person standing near a fence who can't see over it. But someone tall can see above the fence. He sees so much more than others. Similarly, a hechere Yid is a person who can see the world from a higher perspective, and such a person knows that the world is run with chesed and rachamim.
The Chofetz Chaim told a mashal of a person who came to a beis medresh for the first time in his life, and he thought that the gabbai distributed the aliyos unfairly. For example, he saw that the gabbai called up a young bachur for the first aliyah. The person thought, "Why doesn't he call up a respected person for the first aliyah? It must be that the boy is his relative." The next aliyah was given to someone sitting in the back, and the next aliyah to someone sitting on the left side of the beis medresh. There didn't seem to be any method or order. "These are his friends," the man figured. "But it isn't fair that he is choosing on his own. It would be wiser and fairer to go in order."
After the tefillah, he rebuked the gabbai. The gabbai explained to him that he gave the first aliyah to a young bachur because he was the only kohen in the beis medresh. "The person in the back has yahrzeit, so he got the second aliyah..."
The Chofetz Chaim explained that Hashem runs the world with perfect order, and everything He does is with compassion.
A man approached Reb Nota Tzeinvert zt'l with a bright smile and said, "Today, I discovered that Hashem is kind and performs kindness." Reb Nota replied to this man with a story of a person who was having difficulty understanding a passage of Gemara he was learning. After toiling over the Gemara for some time, he discovered that Tosfos asks his question. He read Tosfos’s answer, and it resonated with him. On the margin of the Gemara, he wrote next to the Tosfos, "Also, me, Yankele from Yerushalayim, agree with Tosfos' answer." With this short story, Reb Nota taught this person that it is clear and obvious that Hashem is kind. Hashem doesn't need his haskamah.
The man replied, "Is it forbidden to say that I saw that Hashem is kind?" Reb Nota quipped back, "Is it forbidden for me to tell you a story?" Regarding our topic, perhaps it is known that Hashem does everything and that He is kind. To say such matters might be akin to saying, "I, Yankele, also agree..." Nevertheless, we should talk about and repeat these matters many times until we feel in our bones the truth that everything is from Hashem and for our good.
If we don't understand, it is because we don't see the entire picture. The Chofetz Chaim told another mashal of an unlearned person who heard someone say in Ashrei, הרשעים כל ואת אוהביו כל את 'ה שומר, "Hashem protects all who love him and all the wicked..." The man didn't understand. "I understand that Hashem protects the people who love Him, but why does Hashem protect the resha'im?" Then he heard another person say, כל את ישמיד הרשעים כל ואת אוהביו, "For all those who love Him and all the wicked He will destroy." He didn't understand why Hashem would destroy, chalilah, those who love Him. But then he heard the entire pasuk, שומר ישמיד הרשעים כל ואת אוהביו כל את 'ה, "Hashem protects all who love Him, and all the wicked He will destroy." Now the pasuk made sense to him.
When we see the world, we don't see the entire picture, and that's the reason we have questions. We only see what happens in this world, but we don't see what happens after one's death, and what happened in previous gilgulim. But if we could see the entire picture, we would know that Hashem is just, and all his ways are compassionate and kind.
There are many things that we don't understand, but we aren’t expected to understand Hashem's ways. We are not in heaven to see the entire picture, but we believe that everything is only Hashem's compassion, everything is kindness, and everything is exactly as it should be.
The Ibn Ezra (Devarim 14:1-2) writes that just as children rely on their parents to take care of them in the best way, we are Hashem's children, as it states אלקיכם 'לה אתם בנים, and we should trust that Hashem is leading us with kindness and with compassion. We don't always understand, but like children, we know that it is always good.
It states (Bereishis 6:8) 'ה בעיני חן מצא ונח, "Noach found favor in the eyes of Hashem." Some explain that Noach found favor in Hashem's eyes because Noach believed that whatever happened to him was 'ה בעיני, by Hashem's hashgachah pratis.