Thornmail is also triggered by Infinite Duress, so it would appear that Thornmail applies to anything that would apply life steal.
Damage is reflected when hit by an attack, regardless of whether the attack deals damage. If the attacker is blinded, or the wearer is protected by a shield or invulnerability, damage will still be reflected.
Abilities that apply on-hit effects, such as Blade Waltz, will trigger Thormail.
If you have >233.3 effective armor, Thornmail will reflect more damage than you receive, assuming the attacker has 0 magic resist; if they have 30 magic resist, >333.3 armor is required.
Thornmail is a particularly effective defensive option when facing down opponents whose damage is dealt primarily through autoattacks, or against opponents that utilize on-hit healing to survive fights (such as life steal).
There is a common misconception that life steal and magic resistance "counter" Thornmail, but this is largely incorrect. A combination of magic resistance and life steal will mitigate the reflected damage, but only large quantities of either will see net health gains from life steal.
Thornmail is often overshadowed by the other two high armor items, Frozen Heart and Randuin's Omen, because it benefits only the wearer instead of the entire team and only provides armor.
There are some situations where Thornmail is more effective than Frozen Heart, however. If your champion is manaless for example, it may be better to buy Thornmail, because the mana from Frozen Heart is completely wasted. Thornmail is also more effective than Frozen Heart against some champions, such as Master Yi and Fiora; on Master Yi's case, due to its ultimate Highlander, he becomes immune to attack speed slows, therefore Frozen Heart is innefective against him, but not Thornmail.
If there is another champion with Frozen Heart on your team, it may be better to buy Thornmail, as multiple Frozen Hearts don't stack, it would be cost-inneficient to buy another Frozen Heart unless your champion makes extremely good use of the mana and the CDR, such as in case of Ryze.
However, there are also situations where Frozen Heart may prove to be a much better choice, for example:
Your champion is not being focused; Thornmail is only effective if your champion is actually being focused.
Your champion makes extremely good use of mana and cooldown reduction; this is the case on Ryze, Nasus, and Cho'Gath, for example.
The enemy champion is attack-speed reliant, but has non-physical on-hit effects (e.g. Jax, Vayne, Kayle, Fizz, Teemo, etc). In this situation, the on-hit effects bypass Thornmail's passive. By reducing their attack speed, the on-hit effects are activated less times; as such, Frozen Heart reduces way more the damage taken, when compared to Thornmail.