By his calculation, we will not attack another nuclear armed state. He also sees rich, nuclear free neighbors who may be inclined to pay him off rather than risk his state failing. The implicit threat of the 'madman with nukes' routine is that if he's going down, everyone's going down with him. Much of Kim's carefully cultivated image of being insane is to scare the neighbors into giving him what he wants, but if his regime falls, he will not go quietly.
He is sane, but badly warped. He views his state as his by natural right, and his citizens as slaves to his will. His concern for them only extends to their capability to serve his interests. Whether or not they starve by the millions, or burn in nuclear fire, is simply not his concern. He cares only about maintaining power and obedience. His entire nation is a gulag, a nightmare realm of misery, starvation, and cult like leader worship.
Kim Jong Il has powerful enemies abroad, and a society he dare not try and reform. This type of person will never, ever be motivated to disarm. He must either have nuclear weapons, or lose his grip on power.
I'm not sure (in honest ignorance) that this is entirely clear or obvious. How much is really publicly known about the structure of KJI's regime? Has, for instance, he regularly purged the military and ruling councils like Saddam did, and been able to reply principly on trusted family members (isn't he a bachelor?) or are there permanent cabals that he's dependent on and may have to answer to in some circumstances? Not that a military dictatorship would be that much of an improvement (or even would fully qualify as a "regime fall") but I wouldn't be so sure that a bloodless coup couldn't happen.