What made Bil'am suddenly understand in 24:1 that G-d wanted the Jewish people to be blessed? Milgrom (1990, p. 201) writes that Bil'am learned this from his second blessing, 23:23. This cannot be since even after the second blessing Balak took Bil'am to a third place to curse the people, and Bil'am instructed Balak to offer sacrifices as part of his and Balak's efforts to curse the Jewish people, 23:27-30. Instead, it must be something about the place that Balak took Bil'am to offer the sacrifices and curse the Jewish people, 23:28, or the sacrifices themselves that made Bil'am wake up, 23:29,30.
One possibility is that coincidently the place where Balak took Bil'am to curse the Jewish people was exactly the place where the Jewish people had camped prior to their battle with Sihon, 23:28 and 21:20. Thus, maybe at this place Bil'am saw some evidence of the Jewish people's great victory over Sihon and from this he understood that G-d wanted the Jewish people to be blessed. (This seeing could then correspond to Balak's seeing in 22:2.) Or, maybe Bil'am saw some remnants of the camping of the Jewish people that led him to realize that the people were to be blessed.
A different idea is that it was the third set of sacrifices that made Bil'am wake up since it reminded him of his incident with the donkey. Bil'am had struck the donkey three times to get the donkey to go where he wanted, and the donkey and the malakh had questioned Bil'am why he hit the donkey three times, 22:23-33. The sacrifices prior to each attempted blessing (altogether three sets: 23;1-4,14,29,30) were similar to the hitting of the donkey since in both cases Bil'am was trying to force something to happen, either to get the donkey to walk in a certain way or to curse the Jewish people. Thus, maybe as the third set of sacrifices were being offered, Bil'am realized that just as he was wrong to hit the donkey three times since there was a reason the donkey was not going in the correct direction, so too it was wrong both to offer sacrifices to try to curse the Jewish people and to curse the Jewish people. This possibility is supported by the fact that this realization by Bil'am is recorded immediately after the sacrifices were offered, i.e., 24:1 (the realization) is the next verse after 23:30 (the description of the sacrifices being offered).
Milgrom, Jacob, 1990, The JPS Torah Commentary: Numbers, Philadelphia: The Jewish Publication Society.