A mistress is a female master — she's the one in control. The wardrobe mistress is in charge of costumes for a theater. At some schools, the head of the school is called the headmaster or headmistress.
A woman who has an illicit affair — that is, a sexual relationship with someone she's not married to — is also called a mistress. It’s a somewhat old-fashioned word — it’s one-sided, sexist, and often suggests financial support in exchange for sexual favors. On the other hand, history offers some fascinating examples, such the mistress of King Louis XV of France, Madame de Pompadour, renowned for her intelligence and charm.