The answer to this question of how could the magi follow the star need not be so complicated, although this explanation may appear to be. Please bear with me.
As indicated previously, all heavenly bodies appear to rise in the east and appear to proceed, through the night from east to west to set in the west, unless the sun rises prior. Given that Persia or Arabia is east of Judea, the magi could have been in Persia, seen the body appear to arise in the east, watched it through the night, and seen it track to the west. It may have appeared to stop over Judea depending upon the season, not setting before the sun arose from the magi's perspective.
Once they decided to make their journey, they had a ground track to follow from watching the body, and they could check their course each night as the journey progressed. The magi may have been awaiting this event for a long time, based on oral or written tradition due to Daniel, who was appointed head of the magi during his time in Persia. In this case, they would have logically visited King Herod in Jerusalem, assuming that he would have been awaiting the new King as well, perhaps not aware that Herod was not Jewish. After Herod and the scribes advised proceeding to Bethlehem, which was close by, as mentioned above, the star "disappeared" and "reappeared" overhead, perhaps due to the longitude difference from Persia to Bethlehem / Jerusalem, the magi would have surmised, that they were in the correct place, and they probably knew Jews lived in Judea. As to whether the star or heavenly body actually disappeared and reappeared, this can be explained culturally as follows:
While I was in the USAF in the early 80's, my crew and I were deployed to Saudi Arabia. We landed after midnight, and the local customs officials in Riyadh, would not process us into the country, because a cloud overcast prevented them from seeing the moon. They were waiting to see the new moon to declare the beginning of a new month. Since they could not see the moon, they were prohibited, either by tradition or Islamic law, from assuming the new day of the new month, so we were required to wait until daylight, after flying all the way from the UK. Finally we made a bargain: We were allowed to leave our belongings on the aircraft and proceed to the hotel, under house arrest, until the following evening, when the moon was visible, and we were called to return to the airport to process through customs and immigration.
Using the same cultural logic, the "star" could have been thought to "disappear" and "reappear" if clouds or other obscuration were present between the time the magi arrived in Jerusalem, gained audience with King Herod, and continued to Bethlehem.
Some of these assumptions are not scientific, but they are observable in the "real" world.