First, Gilly doesn't go through the formulaic routine of acting like a brat, encountering a magical moment where someone believes in her, and then becoming an angelic figure. She still acts like a rotten brat, but Paterson fleshes out her leading lady. Despite maintaining her tough exterior, Gilly internalizes the expectations she assumes others have of her and does the opposite. Simple example: Trotter doesn't tell her to brush her hair and Gilly interprets this as Trotter thinking Gilly incapable of looking presentable. To combat this, Gilly brushes her hair and goes to school to show that she can be presentable. This pattern occurs throughout the novel, turning Gilly into more than a grouchy foster child despite her every intention to remain one.
Secondly, and spoiler alert, there's no happy ending. Gilly doesn't have a happy reunion with her mother, nor does she get to stay with Trotter and the makeshift family she could finally define as home. Gilly is forced to live with her grandmother (due to Gilly's previous actions) and despite her vociferous protesting, she can't beat the system. Despite this unhappy ending, Trotter reassures Gilly, and by proxy, the reader, that it's just how life works. There are ups and downs, but you have to make the most of everything.
Apparently, a movie is in the works with Kathy Bates and Danny Glover, presumably playing the parts of Trotter and Mr. Randolph (the blind neighbor) respectively.