The answer to who can contest a will is an interested person: someone whose property rights would change if the will fell. California Probate Code Section 48 includes an heir, devisee, child, spouse, creditor, beneficiary, and anyone else with a property right in or claim against the estate that the proceeding may affect. Texas Estates Code Section 22.018 reads almost the same. Florida Section 731.201(23) asks whether the person may reasonably be expected to be affected by the outcome, and excludes a beneficiary who has already received a complete distribution.
Standing has a practical test we apply before drafting: if the court threw this will out, would you receive more? An adult child who would inherit by intestacy qualifies. So does a beneficiary under an earlier will, which is why a contest is often paired with a petition to probate that earlier will. A friend or caregiver with no gift under any version usually does not.
The right can also be lost by conduct. In California, a person who was a party to an earlier contest, or who had actual notice of it in time to join, cannot later petition to revoke probate (Section 8270(a)). In Florida, a person served with formal notice of the petition for administration before letters issue must raise the challenge in that proceeding (Section 733.2123). Florida also bars any contest before the testator dies (Section 732.518).