He won the second debate against Carter for not being crazy, as Carter's brilliant pollster put it.
There actually were 2 debates, but Carter did not participate in the first one because he refused to debate with John Anderson, and at the time Reagan refused to debate without Anderson. So Reagan and Anderson debated.
Carter knew that even though Anderson was nominally a Republican, most of Anderson's votes would come at Carter's expense, and Carter didn't want to give Anderson any exposure.
Reagan decided at the last minute to debate only Carter, and by that time Carter's people saw the danger of the president debating Reagan, and wished he could get out of the debate. But since he had previously agreed to debate Reagan one-on-one, he had no choice.
I suspect that Carter hoped and believed that Reagan would not abandon his stance of including Anderson in the debates, thereby sparing Carter the necessity of debating him.