I could not achieve this for years and I always really coveted it. Our clothes do smell like this now and I'm sorry to the artificial laundry scent haters, but it makes me feel like a proper grown up and I am unlikely to give it up.
Here is my fully comprehensive guide 
First - WM Maintenance
Cleaning out the machine - repeated cleaning cycles with some sachet of product until it no longer produces loads of soap bubbles during the cleaning cycle - this gets rid of old soap scum.
Regular 60C washes (I wash bedding, tea towels, towels, cleaning cloths and flannels at this temp) and regular maintenance wash (90C with a sachet of machine cleaning stuff in) - helps prevent the soap scum building up in the first place.
Check for anything nasty stuck in the filter (usually a small door at the bottom of the front of the machine - will spill water all over the floor. Use a towel.)
ALWAYS leave door ajar between washes. Don't close it unless it is actively running.
Second - back to basics with the products and process.
Long/full washes - no quick wash. Generally choose the standard Cottons 40 degree wash cycle (the most basic one on the machine). Don't overfill - aim for about 2/3 full. Make sure there is about a handspan of space (closed fingers OK) between the top of the clothing and the top of the drum.
Trial and error with different washing powders/pods. In the UK I used to get good results with Bold 2 in 1 Lavender, but this was about 13 years ago (I live abroad now). Most machines work best if you put the powder directly in the drum in one of those astronaut hat things (they will usually send you one if you go on the website of any liquid wash detergent). Follow dosing instructions on the box for your load size and water hardness - you may need to look this up.
Remove clothes ASAP from the washing machine, ideally less than 4 hours after the wash finishes and don't leave longer than 12 hours. Dry as fast as possible. If you have a rinse hold setting on the machine, you can use this if you won't be able to empty it immediately - it keeps the clothes soaking in the final rinse to prevent them going mildewy. Then when you press the button it will complete the last 15/20 mins of cycle. Or use the time delay to time the wash so it finishes when you'll be able to remove it quickly.
Try first to get the clean smell with just white vinegar/dettol laundry sanitiser type thing in the fabric softener compartment, without scented products or booster type things.
Third - check whether your clothes have build up
After a wash cycle, smell the wash load. If it doesn't smell fresh and clean then some of the clothes probably haven't been sufficiently cleaned. IME this can happen if you've been overly packing the machine, or not choosing the right wash cycle for the level of wear, overusing detergent or drying clothes too slowly over a long period of time. If you wear clothes multiple times before washing them, most machines have a button to boost the cleaning cycle (often called something like "intensive" or "extra"), or use the amount of detergent suggested for medium soil - it's still more economical than washing them after one wear. You can literally just wash the entire cycle over again, it often takes about 2-3 washes to clear up, but if you feel like particular clothes have more of an issue, you could sit there and smell each item individually (I have done this!!) and only re-wash the specific items which consistently don't get the fresh smell.
For anything where the smell doesn't clear even with multiple washes, try sticking it in a smaller load, at a higher temperature, with more washing powder etc. I get a particular issue with my tops as the underarms hold onto a stale sort of smell, not even BO but something else, perhaps deodorant. Anyway an acid applied directly to the armpit area can help with this - white vinegar again or there's usually a spray in the stain remover aisle for sweat and deodorant, which works well too. If this isn't enough, save the offending articles and throw them into the next 60C wash - this seems to do the trick and it's very rare I find clothes are damaged by this wash if it's occasional - obviously not for things which are delicate but it might be worth a last ditch effort if you'd otherwise throw the item away.
Fourth - ongoing good practice
Once you've found the right washing detergent and cleared up any build up in the clothes/machine, you can experiment with 30C washes or Eco cycles to see if it adversely affects performance, if it doesn't then feel free to go back to those, as they do save energy, but I would never use a quick wash unless you are washing a very small amount of lightly worn clothing - that's what they are designed for.
Drying quickly is really important. The biggest thing which made a difference was getting a tumble dryer, which I appreciate isn't always an option. If you can't use a dryer or dry outside, make sure items are spread well apart - use a tower airer or balcony style airer if possible rather than the stacked X style, in a heated room with good airflow. You can use a dehumidifier/heated airer, but a fan can also work fairly well. Don't have clothing draped over each other as it will dry too slowly. I've always had a 1400 spin WM and don't find a second spin adds anything but if you have a 1200 spin, MNers seem to swear by a second spin cycle.
You can add the more scented products back in once you've eliminated any source of lacklustre smells if you prefer a more highly scented experience. I find it's best if I don't use them for every single wash load as you can go a bit nose blind to it, I tend to buy them when they're on offer and change which scent I buy as well. Then I add the minimal amount which gives me the result I'm after, I don't find it lasts any longer if you add more and I also think that the softener probably builds up in the clothes and causes the problem where they smell starchy (like pasta water).
Keep up the maintenance washes on the machine and KEEP THE DOOR AJAR between wash loads.