This question already has an answer here:
In Harry Potter and the Prisoner of Azkaban, Severus goes into the Shrieking Shack with Harry's Invisibility Cloak on him.
Harry's fists clenched as they watched Snape skid to a halt next to the tree, looking around. He grabbed the cloak and held it up.
How did he know where it was?