In the scene where Gabriella and Troy are singing "Gotta Go My Own Way," Gabriella gave the necklace Troy gave her back to Troy. But later, in the scene where they are singing "Everyday," she is wearing it.
he probably put it somewhere or gave it to his friends because it reminded him of her and he was depressed. When Gabriella chose to forgave him, his friends gave her the necklace again so that she could show troy she forgave him