Ryan had never had an easy life, despite what people undoubtedly thought. Being rich didn't make your life any easier, the problems didn't just suddenly disappear because you had money; people were just less willing to listen. Unless you paid them anyway. No one wants to know that winning the lottery, working harder, acting immorally or marrying someone rich won't actually make them happy. Because what would be the point of all that work, all that pain, just to end up with nothing but more pain? But Ryan knew the truth and it was why he had never cared when people called him stupid, or a poof, or a drama queen. Being rich hadn't made him happy. His attempts to fit in hadn't made him happy, although he had enjoyed playing baseball. He was different. He was gay. And there was nothing he or anyone else could do about it. It was what it was.
And now, even now that Ryan had these new 'friends' -people who looked to him to help them win the talent show - things wouldn't be any different. Even though these people said that they were nice, were tolerant, wouldn't use him like Sharpay had, they would. In making him help them they already were using him to get back at Troy. Even Chad (especially Chad). And the team still wouldn't want him in the changing room with them because, of course, as a dirty, perverted, gay person he would have to look at them whilst changing and imagine doing disgusting things to them. And Ryan couldn't forget how they had treated Troy and Gabriella when they had come out as singers. He remembered it well, how Sharpay had hissed at him in the canteen. "See," she had said, "that's what they do to their own friends. To the people who are one of them. Just think what they would do to you."
And Ryan had. He had stopped looking at Chad every time he passed, stopped doodling hearts on his books, stopped mentioning the thought of them as a couple in his diary. He had stopped wanting to be one of them because he knew he never would be, no matter how many times Chad smiled at him (and lately that had been a lot) and the (too few) kisses they had shared. When Troy came back, repentant and belonging, it would be him they welcomed, and Ryan they would push out of their friendship group, their need for him gone. And he would be back to being his twin's little lapdog, hearing her cruel laugh at how he had ever thought that someone might like him.
So Ryan had stopped hoping and put everything he had into the talent show because when it was all over that was the only thing he would have left.