The fact that Scout actually thinks about what it would be like to be Mayella shows that she has learned empathy.
When Tom Robinson testifies, Scout thinks to herself that Mayella must be the loneliest person in the world. Mayella spends most of her time all alone or with the children, has no friends, and rarely leaves the house.
When Atticus asked had she any friends, she seemed not to know what he meant, then she thought he was making fun of her. (ch 19)
When Atticus treats Mayella respectfully, she thinks he is sassing her. She has never been treated politely or called “m’am” before.
Most people in Maycomb ignore the Ewells. They exist as a society unto themselves, by the dump on the outskirts of town. They do not get visitors. Their children do not go to school.
Mayella remains at home alone with seven smaller siblings that she alone takes care of. They are dreadfully poor, and Bob Ewell drinks away their government welfare checks.
Maycomb gave them Christmas baskets, welfare money, and the back of its hand. Tom Robinson was probably the only person who was ever decent to her. (ch 19)
Mayella ends up betraying the only person who was ever kind to her, because her father saw her with a man—and not just any man, a black man.
In the beginning of the book, Atticus tries to teach Scout empathy. When Scout watches Mayella and Tom Robinson testify, we realize how much she has grown up. She is beginning to understand what it means to see things from another person’s point of view.