Understudy
An understudy learns a role so that they can step in if the scheduled performer is injured or unwell. In ballet the usual word is cover: a dancer is said to "cover" a role.
How covering works
Covers learn the steps, attend rehearsals and often watch from the side, but may never dance the role on stage. When they are needed it can be at very short notice, sometimes during an interval, when a dancer has been hurt in the first act. Many careers have been helped by a cover seizing that moment, and a soloist or corps member stepping into a principal role is not unusual.
For the audience
A change of cast is usually announced before the curtain rises or printed on a slip in the programme. Reading a Ballet Programme explains how to spot it.