As it turns out, Chicago poet and journalist Carl Sandburg is one of--if not the--first person to be credited with an old piece of advice for lawyers:

If the facts are against you, argue the law. If the law is against you, argue the facts. If the law and the facts are against you, pound the table and yell like hell.

As well as sourcing Sandburg's quote, in his article for the journal American Politics ResearchLaw, Fact, and the Threat of Reversal From Above, University of Alabama professor Joseph L. Smith uses the latest in computer content analysis (basically, the use of algorithms to categorize writing based on important recurring terms) to examine administrative law opinions from 1925-2002 to test that advice. More specifically, Professor Smith tested whether judges felt more constrained by the facts of a case or the legal standard governing it. His conclusion:

The more a case focuses on factual matters, the more magnified is the effect of the judges’ preferences. Increased focus on legal standards dampens the effect of policy preferences. When cases turn on factual matters, variation in judges’ policy preferences generates wide variation in outcomes.

This will hardly surprise any litigator who has ever read an adverse opinion while shaking their head at the factual findings: law tends to be easy to look up; facts take on many shadings over the course of briefing. What Professor Smith does is to turn this general observation into concrete advice based on statistical analysis. To wit:

The results presented here suggest an addendum to Sandberg’s aphorism: “If the judge is with you, argue the facts. If the judge is against you, argue the law.” The effect of judges’ policy preferences is magnified in disputes that focus on factual matters, and dampened in disputes that focus on legal standards. The most plausible explanation for these results is that law constrains judges indirectly: judges believe cases decided on facts are less likely to be reviewed by higher courts, and therefore see in factual cases opportunities to indulge their policy goals with little fear of reversal. A slightly different explanation would be that judges may be emphasizing the factual elements of disputes whose outcomes match their policy goals and manipulating the contents of these opinions to make the cases look like they were about facts.

(Emphasis added.)  One can take Professor Smith's advice even further. When faced with a results-oriented judge, it may be even more important to develop as sound a factual record as possible. After all, the less ground one can give the judge to shade the facts, the harder it will be to rule against you. The article is well worth a read.