What leads to contentious tenure cases and can they be avoided?
One source of problems is a lack of communication over what are the expectations for the tenure candidate to meet before becoming "eligible" to receive tenure. But a substantial amount of the issues can lie with either someone in the decision-making chain, or the candidate himself or herself. In the latter case, this makes a tendentious situation inevitable.

For instance, there is the rather notorious case of James Sherley at MIT, who alleged multiple issues, including racism, and claimed that he believed his papers from his previous institution would "count" toward his tenure case. (Meanwhile, at MIT, his publication list in five years amounted to a total of six publications, three of which I believe were editorials.) He went on to hold a hunger strike to protest. 

So I think that there really isn't a way to prevent things from becoming contentious unless everything is made "open": criteria are specified in advance, and everybody participating can follow along the entire process. (That is, the candidate can attend the meetings where the tenure case is being discussed.) However, I suspect this is unlikely to occur.