If you ask me, it's amazing Nixon came as close to winning as he did. Virtually nothing went right for him in that campaign.
The Red Scare and Anti-Catholicism probably helped him quite a lot.
How would the Red Scare have helped him against JFK in 1960?
A private poll commissioned by Nixon' campaign stated that the voters preferred Kennedy two-to-one on domestic affairs, but Nixon in foreign policy by the same margin, and thus focused his campaign on Cold War issues. This was no doubt a side-effect of McCarthyism.
Why would McCarthyism damage JFK of all people?
A simpler explanation is that Nixon became associated with the largely successful foreign policy of the Eisenhower administration.
The McCarthy era created a political perception that Democrats were appeasers of Moscow while Republicans were militarists who would oppose their imperialism. Democrats throughout the 1950s attempted to deflect this with the "missile gap" nonsense. This lasted through the entirety of the Cold War, and only hurt the GOP in 1964.