In Avengers: Infinity War, Thor gets Stormbreaker, and uses it to summon the Bifrost, bringing him, Rocket and Groot to Wakanda to fight Thanos' troops. But how did Thor know that they were in Wakanda, he didn't even know Wakanda existed, and Heimdall was dead so he couldn't direct him?
There are multiple options
1. Energy Signature
Thor must have tracked the energy signature in the battle with the help of Rocket.
From a similar question in Quora
At the end of the movie in the post credits scene we see Maria Hill and Nick Fury driving in a vehicle discussion an energy signature that it coming from Wakanda, one that is 10 times stronger than the signature from New York “Avengers 1”. Since rocket was with Thor let’s assume he has technology capable of tracking energy signatures in the same way Fury can buy at a much higher capacity. I would say this is the way Thor knew to go to Wakanda. Rocket traced energy signatures all over earth and found the greatest one coming from Wakanda.
2. Spotted Battle
During the battle Thanos army did fly a large number of spaceships just outside Wakanda. It is possible that he and Rocket located these alien ships and decided to go there.
3. Tracked Mind stone
We already knew that Banner traced the Space stone / tessarract using radiation. Thor could have told something about the mind stone that helped Rocket trace it. It is to be noted that Thor knew somethings about the mind stone and has seen it before.
It seems that other uses of the Bifrost have been able to target a person rather than a location, e.g. in the first Thor movie the Destroyer armour and the Asgardians arrive near Thor rather than at a specific location.
It's possible he targeted the Bifrost at Thanos rather than a specific location.