A person is given numerous tests by Hashem every single day and each one of them is carefully planned out and given with love to elevate the person and enable him to achieve his purpose here. The pasuk says in Tehillim, "נתת ליראיך נס להתנוסס מפני קושט סלה" - it refers to a test as a banner that is lifted up to display. Hashem is so proud when we pass our tests, He could show us off. And at the end of the pasuk it says, when we pass the test, Hashem can justify to the world all the blessings He gives us. When we overcome a test, we shine, we feel good about ourselves, we silence the prosecuting angels in Heaven and we open the door for Hashem to shower us with blessings.
We thank Hashem every day in Modim for the “ניסך שבכל יום עמנו” – simply, it’s referring to the constant miracles that Hashem is performing for us, but some learn that ניסך here is a reference to our tests. Although we don’t ask for them, we thank Hashem every day for giving them to us because it is only through them that we can become elevated to greatness.
Our vision gets skewed seeing the potential immediate gains of our negative actions and it causes us to justify them. If we could withstand the tests and choose the way Hashem wants us to choose, we’ll benefit far more than we would have the other way. We will not always see the immediate gains to those good decisions, but Hashem is trustworthy to pay us for every single one of them.