Why God Favors the Righteous
At face value this is a straightforward question with a straightforward answer: God is good therefore he favors the good. But from a different angle this question is more complicated. Surely God is the god of all, both righteous and wicked, with duties and responsibilities to all and sundry. And more than that, God has allowed wickedness in the world so it must serve some purpose. Maybe from a higher perspective God is neither good or evil, but capable of both. The Bible certainly suggests such an interpretation when we read that the Forbidden Fruit is to know BOTH good and evil, and thus to become like the gods.
So why does God favor the righteous over the wicked? This brings us to the definitions of righteous and wicked. And now we must clarify that righteousness is neither good or evil but the mean, it is right-making decisions whereas wickedness is wrong-making decisions. Righteousness has more to do with wisdom than with goodness or badness per se.
In a morally ambiguous world, where killing can either be in self-defense or blatant murder, God favors those who make the right contextual decisions, not necessarily the a priori morality of their actions. The Bible is replete with killers: King Saul, King David etc. They perform morally questionable actions but yet god favors them still.
At its core, righteousness is a sign of Gods confidence in that persons judgement. Therefore God will favor those who are partners with him in Creation, regardless of the morally dubious actions they might make along the way.
And that is why righteousness is forever changing according to different generations.