In pertinent part:
Rumsfeld was the worst secretary of defense in American history. Being newly dead shouldn’t spare him this distinction. He was worse than the closest contender, Robert McNamara, and that is not a competition to judge lightly. McNamara’s folly was that of a whole generation of Cold Warriors who believed that Indochina was a vital front in the struggle against communism. His growing realization that the Vietnam War was an unwinnable waste made him more insightful than some of his peers; his decision to keep this realization from the American public made him an unforgivable coward.
https://www.theatlantic.com/ideas/archive/2021/06/how-donald-rumsfeld-deserves-be-remembered/619334/
McNamara was many things, but a blundering, idiotic war hawk he was not. There were many mistakes, especially with Vietnam, but there's a reason why Robert Strange was one of the longest serving Secretaries of Defense since the position was created.
Rabid anti-communism aside (which, might I add, was extraordinarily contagious in those days), McNamara came in with JFK on the premise of overhauling how the United States would handle its global security. See, the US military was on a long, slow pivot away from WW2 era conventional warfare. But whereas Eisenhower's administration generally saw nuclear weapons as a way to cut costs and disband army divisions, McNamara and Kennedy more explicitly articulated a "flexible response" doctrine. No more massive retaliation, no more nuking the hell out of the enemy if they look the wrong way. Flexibility would be the name of the game. There are obviously drawbacks of ethics and public knowledge of war, but the long/term trend of the US military towards special forces units, counterinsurgency, and light footprint operations that is still happening today got its start with the flexible response doctrine.
McNamara had some major achievements in reorganizing Strategic Air Command and establishing trends in aircraft roles and weaponry, but as someone who starts to yawn once we get into the weeds about the F-whatever plane, I'll leave that to someone with more science and technology expertise to describe.
I'd also argue that McNamara really represented an optimistic faith in semi-scientific approaches to policy. Policy informed by statistics and numbers, helped along by well-educated technocrats who believed in government; policy not based on arbitrary whims or ideological biases but on data, and data would show the way. McNamara had a real knack for dreaming up big projects, like redeveloping the Mekong Delta a la the FDR-era Tennessee Valley Authority, or creating the Defense Intelligence Agency to consolidate intelligence efforts in the entire department. For better or for worse, McNamara had an intriguing method of formulating policies and he played a key role in big changes and shakeup to US national security during his tenure.
Marilyn Young in The Vietnam Wars has a few great passages about the downfall of McNamara numbers obsession, which I'd recommend for a more critical take on how data functioned in Defense policy during the McNamara years.