In normal water changing technique you use a think called a gravel cleaning siphon to remove some percentage of water from the tank. This has the double benefit if allowing you to churn up the debris out of the gravel and to have a lot of that debris flow out of the aquarium with the water that's leaving.
Then, as you are asking about, you are faced with what water should replace it. Normally, if at all possible, you want tap water to be the starting point of the replacement because it will usually have not only a number of good minerals (such as Calcium) that your fish and tank need, but also because if this is always your replacement water source, then it will better match the current tank water in these "hardness" characteristics.
The practice of "aging" tap water is often confusing to beginners because it used to be done to allow chlorine (which is a gas) to "gas off" into the atmosphere. This is usually no longer done because many water districts have gone to a more complicated schedule of often using "chloramines" (compounds containing both chlorine and ammonia) to lower the bacterial counts in the pipe system. Modern conditioner products will instantly remove both chlorine and chloramine and have other benefits as well, without being overly expensive, and so its considered to be safe practice, especially for beginners, to always dose the tap water with a conditioner (ie. a "dechlorination product.")
An additional concern during the first 6 months of the life of a tank is that the two species of beneficial bacteria that we must grow in the filter will be very fragile during this time period and can be potentially wiped out if the water authority unpredictably overdoses the chloramine or chlorines. For this reason we often recommend that conditioner be dosed at 1.5x or 2x whatever the bottle recommends. Since this gets in to using larger amounts of the product, we also recommend a more concentrated product. For beginners, a good choice is Seachem Prime since it is both very concentrated and also very reliable at other functions such as handling heavy metals and detoxifying ammonia. For mature tanks beyond a year, some aquarists choose to use pond dechlor products in an attempt to take advantage of its higher concentration but possibly lower cost than Prime.
OK, whew! So we put the tap water in the bucket and add some portion of a capful of Seachem Prime that we've calculated to be 1.5x the recommended dosing, roughly. What next?
Well, in a fishless cycling or young tank we might also want to help things along by "temperature matching," which is done pretty roughly simply by using your hand to decide if the tap water and the tank water are roughly the same. For fishless cycling this can help your bacterial reproduction to keep right on going, despite a water change (Fishless Cycles don't normally have many water changes, just sometimes to solve perhaps a pH problem.) Once the tank has fish, then the issue of temperature matching becomes more an issue of not shocking the fish. Changes of cold tap water less than 15 or 20% will not usually result in enough temperature drop to matter, so heating may not be needed. Larger changes will benefit from the lowered risk (aquarists often place greater emphasis on tanks with expensive or valued fish) by doing rough temperature matching. Its a slightly controversial topic among experienced aquarists (they are split between those who feel more safe with temp matching and those who love to give their fish bursts of cold water!) but for beginners many of us feel that rough temp matching is good practice.
OK, so tap water at the rough matching temp plus a good conditioner in the right amount... we've beat this topic to death, right?
Well, there's one more tidbit: Especially aquarists who have pretty big tanks or aquarists with bad backs will sometimes have a type of siphon hose system that allows them to refill the tank directly from a distant faucet in the house. (Its basically a long hose with the right type of adapter for the faucet.) Fishkeepers who do this are generally advised to dose the conditioner in an amount that would treat the entire water volume of the tank, so that any substances in the tank that "use up" the conditioner treatment will not stop it from applying the full dechlorination/dechloramination process. So, dose for the full tank when refilling via hose rather than with buckets.
This outline I've given does not cover special cases where the incoming tap water is extreme in some way, but it covers the vast majority of normal cases, so I hope this will help get you started.
~~waterdrop~~