Another thing to note is that Eliza is very confident in knowing how she should be treated – she knows that the way Higgins treats her and others is very improper, and she is not afraid to call him out on it. She does not tolerate his bad manners, and Freddy encompasses all that is good for her because he is the living version of all her ideals of good manners and sophistication. In Act 5, Eliza emphasizes how much she appreciated Pickering’s view on her as a duchess and not just a flower girl- Higgins’s still sees Eliza as a simple flower girl and that is exactly what she does not want. Both Pickering and Freddy view and treat Eliza the way she desires, and that is something Higgins cannot offer her. Her confidence in knowing what she wants is also noted by Higgins, who actually begins to admire her more when she stands up to him. Her confidence is what drove her away from Higgins, and that is what will drive her away at the end of Act 5. Although Higgins could offer her the independence she wanted, Eliza wants the fairytale ending even though it means that she would have to give up her independence of rash actions and give in to wifely duties. She appreciates being treated the way she wants to be, and she is willing to give up part of herself for that- she signed up for that when she came to Higgins for lessons in the first place. She is ready to leave Higgins and have the life she wanted. Also to note, when Eliza first arrives at Higgins's home and he treats her poorly, she threatens to leave but Higgins tempts her with chocolates and persuades her to stay with delights. Eliza did not know her worth at this time because she still believed that she is just a flower girl, but at the end of Act 4, she knows that she is not just a flower girl, but a woman of worth. When she knew this, it gave her the power needed to walk away from Higgins. With this power, she is capable of walking away again.
I think Shaw left the ending for the audience to interpret as they wished because the entire play is thought provoking and he wanted us to connect the dots for ourselves. He wants us to appreciate his writing techniques of character development to determine the ending- using the characters previous actions and dialogue, thoughts, and morals give clues on how the ending will be.