Motivation can reasonably be reduced to the question "What's in it for me?". If you conclude that an action is contrary to your interests (however conceived), you won't be motivated (moved) to take the action. What constitutes being "in your interest" depends largely on your value system (plus lots of philosophical stuff that we don't have space to discuss). One motivation is reducible to the question "How much money can I get?"; a distinct motivation is "What is right (proper)?" A third version is "How can I be upheld most often?". The first of these is generally abjured as corruption, although it is a real factor in some jurisdictions. The third alternative is a variant of the first, which we generally recognize as being a form of immoral corruption (since the value gained is money).
As for judges who rule in a particular way because that is how they can be upheld most often, that is a variant of the first motivation, which we understand as being economic corruption: rather than gaining dollars (rupee, yuan etc) they gain approval units. Which leaves us with judges that decide based on what is proper. In other words, the matter can be reduced to the choice "Do I decided based on what is?", versus "Do I decide based on what I want?".
As it happens, the notion of "being just" is extremely variable, since there is no generally-accepted understanding of what "justice" even means. Thus appeals to "justice" are pretty useless when it comes to understanding contemporary law.
[Addendum]
You can always complain to the media (I exclude jurisdictions where that is prohibited by law, and there is also a problem that lawyers don't get to fully enjoy the rights guaranteed under the First Amendment). Some judges are elected, so if you can manufacture a sentiment that a judge is unjust, they might be a 1-term judge. There is no such mechanism for appointed judges (which are the majority, as far as I know in all jurisdictions). If they don't correctly apply the law, they might be overturned, and possibly in extreme cases removed (by higher judges). The only other stick is prosecution, which is reserved for certain corrupt actions and not for misapplication of legal principles.