General Principles
Without either gains or extra buys a deck is likely to be quite one paced and will take a number of turns to buy cards for income then more turns to buy cards for victory points. This is seen most clearly with alternate (kingdom) victory point cards since it takes far too many turns to buy the vicory cards and also buy any other cards needed to boost their scores.
Trashing cards like copper out of a deck takes time and can be a waste of time if good cards cannot be put into the deck quickly enough to replace them, usually with buys and gains. The faster that you can put cards into your deck with +buys and gains, the more turns you can spend trashing down to a controlled deck beforehand. The reverse can also be true: the more compact your deck becomes, the more often you will be able to play cards for buys and gains (although you still need income to make use of those buys).
Buys and gains obviously accumulate many cards and suit big deck strategies for kingoms cards like philosopher's stone. Some curse ridden decks will never be repaired and will be improved by accumulating basic treasures such as silver and sometimes even coppers. Action based becks (engines) usually need to accumulate many action cards in order to function. Many key cards in a kingom, such as fool's gold, might work better in large quanitites and it is important to accumulate them faster than your opponents. Buys and gains can deliver the quantity of key cards and can often deliver them rapidly, however time spent preparing the buys and gains could be time spent buying the key cards. This can be particularly important in multiplayer games or when using expensive actions such altar or university.
End Game
There may be no point taking many turns to slowly build a strong deck if you cannot earn a high reward. If an opponent gains a early lead it might be hard to overtake them just buying one vp card per turn. Buys and gains allow you to take more turns to build a strong deck on the assumption that it will be able to score more heavily with more victory cards in later turns. This can certainly be worthwhile if a deck can greatly improve each turn before greening or risks drawing badly as soon as victory cards are addded.
With extra buys you can earn the capability to end the game early by emptying 3 piles when you are ahead. Throne room, procession, and king's court can be strong in these situations too if they can conjure extra buys or gains. It can be difficult to force a three pile ending if you can only buy one card each turn, assuming the opponents don't make it easy for you. This leads onto the topic of defensive play.
The simplest vp purchasing strategy is to buy the highest victory card available on your turn. Another strategy however is to score vp while denying your opponent the chance to win on their next turn. Since the game only ends when the province pile or three piles are empty, you simply leave enough cards in the piles so that so your opponent is unable to empty them (and win) next turn. The most well known example of this is the penultimate province rule (PPR), which relies on the opponent being unable to win until the penultimate province is bought, but as soon as they do that they offer you a chance to win with the last province providing the scores are close. If you have extra buys and gains available you are in a better position to purchase vp defensively, such as buying two duchies instead of the penultimate province or perhaps switching to alternate vp if it is in the kingdom.
Furthermore, if you can buy or gain extra vp cards on your turn it is more difficult for an opponent to play defensively since you can potentially score more on your turn. Similarly if you have many buys and gains it becomes more difficult for opponents to prevent you from emptying piles. Expert players will often try to control the endgame by having more buys and gains than their opponents, and often create situations where they can end the game but opponents cannot.
Buys
In principle, buys are much more simple to use than gains even though they can require decision making during play on how to spend the coins. Generally you want extra buys with large income hands. As soon as +buys are in your deck each coin generated is more likely to be useful. It isn't wasteful to have +buys when you don't need them as long as you have enough buys when you do need them. That's all obvious but it is easy to lose sight of income when crafting a fancy deck. It's also possible to push too hard for income in the early game and belatedly spend a lot of coins for a cheap +buy card in the late game.
For very high income hands, +buys can make sure that all income can be used. A bank is a prime example of card that is best used with +buys, otherwise any extra income it provides above a gold might go to waste. More generally +buys offer the choice to buy multiple cheap cards rather than one expensive card. One expensive treasure is usually better than two cheaper basic treasures, so this more often applies to victory cards, action cards, and key kingdom cards. If kingdom cards are cheap and at different costs then there will me more choice how to use +buys. Extra buys also offer flexibility when dealing with potion cost cards and hands that miss key price points, such as 7 coin hands. A large income hand with a potion often needs a buy for the potion cost card and a buy for the remaining coins.
When you are wanting to build a deck through high spending and extra buys it can be important to keep a focus on income cards. Dominion already needs judgement on the value of a trashing, gaining, or attacks compared to income cards. When a deck has +buys, each coin is more likely to be useful and should be valued slightly more.
Buys naturally support the accumulation of action cards to build an engine deck. Extra buys suit some unique kingdom cards that benefit from buying coppers and curses but I won't discuss them much here. Cards like goons, counting house, gardens, and trader all have their own play style that does not fit any general advice. Black Market has many unique tricks as well. Cost reducers such as bridge, highway, quarry, and peddlers work very well with extra buys and the more that you can combine these reducers with +buys the better the results, even producing 'megaturns' when enough are put together. Coin tokens and +buys both provide flexibility on how coins are spent and it may depend on the kingdom whether they do much more together than either would do alone. Extra buys do however allow the hoarding of coin tokens for big spending turns later in the game.
Most importantly, all the benefits from buys do not come in isolation. For example you might be able to build a deck quite strongly before deciding to pursue a gardens strategy, buying multiple gardens in one turn, adding coppers to boost the scoring, and using buys to force a three pile ending. For an engine builder, not only do extra buys allow more engine components to be added each turn but they can allow an engine to deliver bigger vp turns at the end. This means an engine can be built up over more turns with more resilience, power, and a great deal of end game control.