One of the keys to being able to pull great shots of espresso is consistency on the part of the barista. The idea is that if you want to pull great shots, you need to control the environment. You need the right dose – ie the right amount of coffee in the portafilter. You need the right temperature for the water hitting the puck and creating the coffee. You need to stop pulling the shot at the right moment – not too early so that you have underextracted the coffee and not too late so that it is overextracted. You need the grind to be about the same each time, and that depends on a consistent grinder. You need the distribution of the coffee in the portafilter to be about the same each time so that it extracts the same. You need the tamp to be about the same so that things are reproducible (although there is some question about if this last one is as important and that is something I would like to explore).
Anyway, if you do not have solid control over all of these variables then when a shot tastes wrong, you will not know what can be changed to fix it and when a shot tastes right you will be hard pressed to recreate it. Now the truth is that no one has perfect control over all these variables.
World champions like James Hoffman have blogged that they are not confident that every time they hand someone a shot it tastes the way they want it to unless they taste it first (wouldn’t that be quite a coffee shop!) On the other hand they have very high standards. Tasting the way they want it to for a world champion is a higher bar than tasting the way an average home or even pro barista wants the shot to taste.
None the less with most coffees one should aspire to know roughly what a shot will taste like once it is dialed in to your taste so that you have a good expectation that if you get it the way you want it, you can keep it that way (at least until the beans change on you since the best way to pull them changes as they age – yikes). To pull this off you need very good equipment, good skills, and good beans.