After the
Millennium Falcon escaped from the
Death Star,
the Empire was able to track it to the Rebel Base via a small
homing beacon attached the ship. Such devices transmit a tracking signal that is able to broadcast over incredible distances, so that even an escape into hyperspace won't prevent a craft from being found.