In many cases, you simply cannot prepare - it is the same situation IRL and your only option in many of these cases is to pay attention to what frequency you get from ATC. Especially in cases where there isn’t really a way for you to know then next frequency, (good) controllers are usually aware of it and make sure that you have a good chance of catching the correct frequency the first time, e.g. by not rushing through the digits but clearly emphasizing each.
Nevertheless, you can of course also take steps to make it easier for yourself, e.g. by keeping pen and paper at the ready and noting the frequencies down as you get them. If you are quick enough, it can also help to dial the new frequency into standby (at least partially - a prompt readback is also important, of course, especially on busy frequencies) while ATC gives them to you. Another thing that can be helpful, is to just keep track of the frequency in general. If you notice other aircraft in front of you and going in the same direction, you can pay attention to the handoffs they get as you may be getting handed off to the same controller (but, keep in mind, just because they are in front of you, they may not be flying the exact same route at the exact same level, so their sector sequence may be different).
But there are also cases where you can figure out the correct next frequency on your own and in these cases, ATC may even expect you to know that frequency.
Usually, this is the case in the immediate airport environment. Usually, airport charts will list various frequencies, though it may not always be all frequencies (especially fallback frequencies or more special ones, such as those for deicing crews, are often left out of the charts). In the real world, this usually makes it easy to anticipate the next frequency at airports, especially in cases where charts have further information on what each frequency is for (usually they will tell you which frequencies are for Delivery, Ground, Tower and Approach, but in same cases it’s even further differentiated, e.g. telling you which Tower frequency is used for the Northern runway, which for the Southern runway, and so on). This allows pilots to just prepare the frequencies from the chart - although they of course still need to be prepared for unexpected frequencies.
On VATSIM, it is a bit more tricky as the policies generally don’t allow controllers to use multiple frequencies (though there are cases where it is allowed). Generally, in the airport environment, you can simply look at your pilot client or a map tool to see the primary frequencies controllers are using. If there is only one station per “level”, you can usually expect those frequencies to be the one you get. But there may also be cases where multiple frequencies are in use by a single controller (though in these cases, they are oftentimes the ones on your chart). When there are multiple stations online per “level”, but not all of the ones that exist for that airport, there isn’t really a way for you to know who does what (the login may give you a hint, e.g. ABCD_N_TWR and ABCD_S_TWR are often, but not always, the Towers for the Northern and the Southern sides of the airport, respectively, but that’s about it).
If we then also consider autohandoffs, which are common particularly in Europe from Tower to Radar (but also exist from Tower to Ground at certain airports), where you are expected to switch to a frequency listed somewhere on your chart on your own (i.e. without getting a handoff) and the multitude of different ways that vACCs try to simulate this procedure…
So TL;DR: you can never be 100% sure of the frequency you will get handed off to next and always need to pay attention as well as familiarize yourself with local procedures that are published in the charts (not just the pretty pictures, but also and especially the stuff written in text), regardless of how well you prepare yourself. There are some ways that you can guesstimate which frequencies you will get on VATSIM, but they are usually different from the strategies that you might use IRL.