The short answer
Start by following the recipe. A Daiquiri is shaken, a Negroni is stirred. There's a reason for both, and both change the finished drink. One point here isn't about taste at all, it's about safety: carbonation should never go into a closed shaker.

Two Concrete Examples
For a classic Daiquiri, dissolve the sugar first, then add ice and shake. For a Negroni, stir the ingredients gently in an ice-filled glass. Preparation is part of the recipe, not a flourish for show behind the bar.
The rule behind this is old and simple. What's allowed to look cloudy gets shaken. What should stay clear gets stirred.
Citrus juice, cream, egg white, or syrup need vigorous movement, otherwise they won't combine properly with the spirit. Drinks made from pure spirits, like a Martini, Negroni, or Manhattan, are stirred. Shaking would make them cloudy and frothy.
This comes down to air. A shaker whips in tiny air bubbles and also breaks off fine ice shards. Both are visible in the glass. That's welcome in a Daiquiri, but it's a flaw in a Martini.
Both methods chill and dilute a drink, just at different speeds. Shaking for fifteen seconds adds more cold and more water to the glass than half a minute of stirring. So the method you choose also determines dilution, not just appearance.
Both approaches share the same goal. The drink should be cold and contain the right amount of water once it lands in the glass. Only the path there differs, and with it, the impression in your mouth.
Deliberately Repeat One Method
You can only compare drinks made the same way. A quick stir and a long shake create different starting points. Work your way toward the result you want using small batches.
Keep the amount of ice similar too. A full shaker and a half-empty one don't cool at the same rate. The same amount of time then produces two different drinks.
Count while shaking. Ten to fifteen seconds of vigorous shaking is right for most recipes. If you go by feel alone, you might stop after five seconds one time and twenty the next, then wonder why your results keep changing. The same applies to stirring, though there it's more like twenty to thirty seconds.
Soda, tonic, and other carbonated ingredients get added only after shaking. Otherwise, pressure builds up inside a closed shaker, and the lid finds its own way out. Use a shaker designed for this purpose, and never work with damaged glass.
A few tools are enough to get started. Precise measuring and a clean work surface achieve more than acrobatic moves over your head.
Write down the number of seconds that gave you your favorite drink at its best. It sounds pedantic, but it's the only reliable way to hit a good result a second time.

Shake or Stir: Let the Recipe Decide
Most recipes don't even specify the method. These three cases cover what typically comes up at home. The carbonation case is the only one where it's not about taste, but about safety.
| Situation | Practical Approach |
|---|---|
| The recipe calls for shaking | Work in a suitable shaker with ice, then strain as directed. |
| The recipe calls for stirring | Chill with ice in the mixing glass and dilute in a controlled way. |
| Soda, tonic, or another carbonated mixer | Don't shake it in a closed shaker; add it at the specified point instead. |