To Kill a Mockingbird by Harper Lee is set in the South (Maycomb, Alabama) during the 1930s, and this is significant to know when you are thinking about the role of Mayella Ewell in this novel.
Mayella is the oldest child of Robert E. Lee Ewell, and her family is exceptionally poor. The town allows Bob Ewell to hunt where others are prohibited simply because it understands that Ewell spends any money he gets on alcohol and his children would starve if he were not allowed to hunt freely and thereby provide food for his children.
The Ewells' home is a virtual junkyard where nothing beautiful can exist; however, Mayella does what she can to make the best of her abject poverty by growing and caring for red geraniums.
Against the fence, in a line, were six chipped-enamel slop jars holding brilliant red geraniums, cared for as tenderly as if they belonged to Miss Maudie Atkinson, had Miss Maudie deigned to permit a geranium on her premises. People said they were Mayella Ewell's.
She does not seem to have any of the worst characteristics of her drunken, abusive father.
We only meet Mayella once, though we do hear about something that happens before we meet her. We meet her at the trial for Tom Robinson, a black man accused of raping a white woman. Mayella Ewell is that white woman.
At the trial, she has dressed herself in the best she has and has done her best to make herself presentable for this setting; however, she is backward and quite frightened, and soon we find out why.
In her testimony, Mayella claims that Tom Robinson attacked (raped) her and then ran away when her father showed up and was angry. When Atticus gently questions her, she is belligerent and defensive; however, Atticus is able to get some important concessions from her. Between those admissions and Tom's testimony, we learn the truth of this situation.
Tom regularly passed by the Ewell home (which bordered the Negro settlement in which he lived), and he was always willing to do her a favor if he saw she needed something. One day Mayella invites him in to chop up a chiffarobe (dresser or bureau) for kindling. It turns out that she has made elaborate plans to be alone with Tom. She saved a long time so she could give each of her siblings a nickel each to go buy some ice cream and have the house to herself. When Tom is there, she kind of grabs him in a hug and awkwardly tries to kiss him. She tells Tom that her father's kisses do not count (implying another kind of abuse imposed upon Mayella by her father) and she wants to be kissed. Obviously she has developed a kind of crush on Tom because he is the only person in her life who shows her kindness; however, she also knows that a black man can be killed for touching a white woman. Her need for human comfort and companionship outweighs the stigmas placed upon such things by society.
Ewell comes home and sees the embrace, and of course Tom runs for his life. The next day, Mayella accuses Tom Robinson of raping her--obviously pressured by her father to do so. She is terrified of Ewell because he beat her after Tom ran away, and he sits in the courtroom smugly (and threateningly) listening to her lie.
It is obvious to everyone that Tom is not guilty, especially because one of his arms was mutilated in an accident and he could therefore not have punched her as she claimed; however, this belief in the automatic guilt of any accused Negro results in a guilty verdict. We see Ewell again, but we do not see Mayella.
Note the excellent eNotes sites below for more analysis and insight.