An element is a cheap part, and most of the cost of changing it is access.
Testing
Isolate the supply, confirm dead, then test continuity and earth. A grounded element trips the breaker as soon as it is reset — that is the signature.
Removing it
Drain, remove the cover and insulation, disconnect, unscrew. In a closet, expect to work in a small space with the tank partly drained, so plan the route for the water before starting.
Fitting
Clean the thread, fit a new gasket, tighten to the maker's figure. Fill the tank completely before restoring power; a dry element fails in seconds.
Checking afterwards
Run a hot tap, confirm the temperature, and look for weeps at the element once the tank is warm.
The repeat-failure question
Two elements in a few years means the water or the space is the cause. Where a test shows scale, treatment shortens the cycle. Where the closet runs hot, cooling and clearance help.
What to have ready
Symptom, breaker behaviour, age, location.