Nishikata is simply suffering from a chronic PTSD. It's perhaps quite pitiful in his case because normally you'd talk about it concerning war veterans, victims terrorism, or major accidents/catastrophes, but people react differently to different things. Nishikata has been bullied for years endlessly. The stress and doubts accumulated day after day, until he broke mentally. He might have got healed if he rejected Takagi and married a normal woman, or even lived alone, but he ended up with Takagi, and the rest is tragic history.