First, let me say that bad things happen to us because we live in a sinful world. Unfortunately, for reasons He knows alone, God has kept us in this sinful world until we die. Then we will be truly free. (We are free now, but not from the effects of sin. That happens at death.) Good or bad things happening to you isn't a sign of God's love or absence of love. His promise and the cross are pledges of His love (Rom 5:8). That's why you need to hear the promise of God every day and remember the death and resurrection of Christ every day.
Second, you can do nothing to "win" God's favor. You already have it. How do you know? You're a believer, aren't you? God didn't show His favor on you when you became a believer. You became a believer because God showed His favor on you and made you alive with Christ (Eph 2:1-10). You see, you didn't do anything to "win" God's favor. You had it all along. He loved you from eternity. Nothing can change that.
The Justified Sinner