This question already has an answer here:
During the Battle of Hogwarts, Voldemort found that the Elder Wand, which he had taken from Dumbledore's tomb, was not working as impressively as he had hoped. Believing that this was because Snape had its allegiance after killing Dumbledore, Voldemort had Nagini kill Snape.
When he and Harry faced off shortly afterwards, Harry corrected him: since Draco had disarmed Dumbledore, he was the true master of the Elder Wand, not Snape. When Harry disarmed Draco in Malfoy Manor,he was having a different wand in his hand.
Then how the Elder Wand's allegiance shifted to Harry Potter ? In case the Elder Wand's allegiance shifted to Harry potter, when Voldemort used killing spell on Harry at forbidden forest, the wand's allegiance should have shifted to Voldemort. Why didn't the Elder Wand's allegiance shift to Voldemort?