I agree with you OP and I have been on a mission to work this out too :D It always somehow makes me feel like a competent adult when I can get my washing to smell nice.
You always get the bores on these threads who hate laundry fragrance - no idea why they click on them. I wouldn't go on an olympics thread and tell everyone "ACKSHULLY SPORT IS A WASTE OF TIME AND THESE COMPETITIONS ARE SO BAD FOR THE ENVIRONMENT!!" just because I don't fancy watching it myself.
Anyway.
What did your last machine die of? I do think that there can be a bit of user error in getting the right balance between using enough detergents to get a nice smell and using too much or washing too many clothes at once which will damage the machine.
Did you install it yourself or did a professional do it? One issue can be insufficient water supply or poor draining.
How full do you pack the machine? It is worth experimenting with different load sizes and see how things come out. Also, this sounds absolutely bonkers, but get your laundry basket of dry washing and weigh it using a luggage scale or by standing on your bathroom scales holding it, then subtracting your own weight. I think it's surprising to work out how much you are actually washing. I was not using enough detergent for the amount of washing I was doing, because a lot of the standard amounts are for smaller loads like 4kg.
I find that powders are the best - and experiment with lots of smaller boxes/bags of different brands. I find that the huge big boxes go "stale" and lose their smell. The cheaper ones can sometimes be better than expected. Read the instructions on the side of the box, use a measuring cup or measuring scoop and try using exactly as much as is suggested. If it creates loads and loads of foam, try using less, if it doesn't smell nice after washing, try using more. When I lived in the UK, I used to swear by Bold 2 in 1 Lavender powder, plus a cup full of white vinegar instead of fabric softener.
I think that our old machine was not washing effectively towards the end and some of our things had to be washed 2-3 times in the new one, to get them to smell fresh again.
Leaving washing damp can reduce nice smells and/or replace with mildewy smells. Drying it ASAP is key - either outside in wind/sunshine, or in a tumble dryer if you have the option. If you have to use an airer, make sure it's a good one which leaves space in between the clothes and doesn't drape them over each other, and leave in a place in the house with good air flow.
Try different cycles - different temperature, try out any extra modes too like pre wash, intensive, any options to see what they do.
Avoid using a quick wash unless the clothing is really lightly used and it's only a couple of things. They don't wash as well as the full cycle. Recommend reading your machine manual, too.