I may be oversimplifying but I think the easiest way to understand the difference is to remember the difference between the て形 and the 連体形 (dictionary form).
The て形 is used to join independent clauses and can also be used to adverbially modify verbs.
The 連体形 is used
to terminate sentences or to adjectivally modify nouns.
EDIT: I was not correct in the claim that the 連体形 can terminate sentences. The verb form that can terminate sentences is called the 終止形. In modern Japanese the 終止形 and 連体形 are the same for 形容詞 (i-adj) and 動詞 (verb) but different for 形容動詞 (na-adj). きれいな = 連体形, きれいだ = 終止形. Thank you commenters.
Thus, you use に反する when the modified noun is contrary to something and に反して when the whole clause is contrary to something. (it might be more correct to think of it as modifying the verb only rather than the sentence, I'm not certain how Japanese grammar is thought of from a native perspective).
Contrary to expectations, the team made it to the finals.
I put the comma in to show that the 反して clause it is somewhat separate from the rest of the sentence. I don't know if the Japanese would actually include it or not. In this sentence, proceeding to the finals (the entire clause) is contrary to your expectations. Thus に反して is appropriate. If you used に反する, you would be saying that simply the finals (for some reason) are contrary to your expectation (which doesn't really make sense to me at least).
The recent nation-wide election ended in a result contrary to the predictions from before the ballots were counted.
In this sentence, the "results" are contrary to the predictions. The 反する clause is describing what kind of results there were, not how the election ended.
Contrary to the wishes of employers, you cannot force employees to work.
Again, the entire clause is contrary, not just "employee".