If you want the pianist to stay on for a bit at the end of class as a favour, the diplomatic way is to say to the students “We’ll do that again in a moment, but I have to let Miss X go, so thank you very much Miss X”. If the pianist is able and willing to stay, they will. Once a pianist knows that you respect their time, they will be more inclined to help next time. This method sets a good example of professional behaviour to the dancers/students as well.
Some dancers ask why pianists aren’t so willing as dancers to go the second mile and play some rehearsals for free, or give an extra half hour at the end of class. The reason is that for the dancer, the time they give up is an investment in their own technique and career, because it leads to a performance in which they feature. For the pianist, there’s no such trade-off. I’ve done lots of things for free or little money because of some other trade-off, even if it’s just social ( I like the people I’m working with)the work’s interesting, or I’ve got some time to kill. But in the end, like it or not, there’s sometimes nothing like money to get the best out of people!