What these clauses say is that anyone who receives an inheritance from a will or who is a beneficiary of a trust receives nothing, if they challenge the validity of something in the will or trust. They effectively disinherit anyone who is not satisfied with the assets that they receive.
Even no contest clauses are not bulletproof as the Wills, Trusts & Estates Prof Blog discusses in "Take It or Leave It: The Perilous Decision of Whether to Violate a No Contest Clause."
Sometimes when a person challenges a no contest clause and loses the challenge, courts will refuse to enforce the clause. Sometimes when a person challenges a no contest clause and wins the challenge, the court will enforce the clause anyway.
The difference between the two extremes is a matter of individual state law and what exactly is being challenged.
There are different rules in every state.
Anyone who wants to challenge the contents of a will or trust needs to make sure that they speak to an experienced elder law attorney in the appropriate state to get good advice about what challenges are worth making and what challenges should be avoided at all costs.
Reference: Wills, Trusts & Estates Prof Blog (Nov. 24, 2017) "Take It or Leave It: The Perilous Decision of Whether to Violate a No Contest Clause."