In Star Wars: A New Hope, the next morning after R2-D2 got away on his "mission", Luke Skywalker and C-3PO (piloting the X-34 Landspeeder) headed off looking for the astromech until they track and find him using a scanning device.
After doing some research about this device, I have found that it has been referred as a scanner, metal scanner and built-in metal detector.
According to the script, it appears that it was a device embedded in the dashboard of Luke's Landspeeder.
“Wait a minute,” he advised Threepio as he stared fixedly at the instrument panel. “There’s something dead ahead on the metal scanner. Can’t distinguish outlines at this distance, but judging by size alone, it could be our wandering ’droid. Hit it.”
Unfortunately, after looking at the information contained in the Star Wars: Complete Vehicles: Incredible Cross-Sections of the Spaceships and Craft from the Star Wars Galaxy book by DK, there is no such scanner described in the book.
Also in the script, Luke takes a small control box from his utility belt to find the droids but in the Star Wars canon and legends the first appearance of a portable scanner (potentially able to detect droids) was in Star Wars: Episode V - The Empire Strikes Back.
For the aforementioned, I ask, what is the nature of the device that permitted Luke to track and find R2-D2?
In order to have a visualization of the distance between the Lars homestead and the jundland wastes where Luke and C-3PO found R2-D2, here a map of Tatooine (Wookieepedia) showing R2-D2’s escape route from Lars homestead.
Making a roughly estimation of 16 hours between sunset and dawn in Tatooine, assuming that R2 was fully charged when he left Luke's garage and that he moved at 1.4 m/s (aprox. half his max speed), the distance he traveled was around 80.0 kilometers; matching the map distance. Thus, or the scanner was very powerful or Luke and C-3PO, thinking that R2 would seek for Ben Kenobi, headed straight towards the desert wastelands and with a low-power scanner they were able to find the astromech.