I think the point of the ending is to be realistic. It would be great if, in the end, they let David stay at school, Bobby gave a heartfelt apology to Pharus, Pharus gets to sing at the graduation, and David and he ride off into the sunset together. However, realistically this would not happen.
David would be suspended, and Bobby isn't going to apologize because being gay is not as widely accepted as we wish it was.
In the end, we see Pharus, beaten and bruised, taking the slurs Bobby throws at him. He just stands there and takes it, and we know even though things aren't perfect and he's going to have to fight for his place in the world, he's going to be okay.
I love the contrast of Bobby calling Pharus the f-slur while singing the song, and Pharus standing tall, not giving him any attention. Really highlights their true characters.