In Harry Potter and the Half-Blood Prince, Dumbledore knows where Horace Slughorn is hiding because of a memory charm that Horace himself had placed on the people he met, causing them to forget about him.
To find Slughorn, Dumbledore uses his knowledge of Slughorn’s habits and the fact that Slughorn is very fond of surrounding himself with talented or famous individuals. Additionally, Dumbledore uses his connections and magical skills, including asking various people about Slughorn’s whereabouts and considering where he would go to remain hidden.
Dumbledore eventually tracks him down to a remote location where Slughorn had been living in seclusion, trying to avoid being found due to his own guilt over the events during the First Wizarding War.