Mr. McNamara helped lead the U.S. into the Vietnam War and spent the rest of his life wrestling with its moral consequences.