I don’t like talking about the usage of ～んです because I use it all the time without thinking why I am using it, so it is not easy to explain when to use it. But I thought really hard and here is the list of occasions when I use ～んです.
1. adding a reason afterwards
おかねを かして ください。さいふを おとしたんです。(plain past verb)
Please lend me some money. I’ve lost my wallet.
ぜんぶ たべても いいですか。おなかが すいているんです。(plain non-past verb)
May I eat it all? I’m hungry.
2. When I want the other person to react to what I say or when I have more things to say afterwards.
あした シドニーに いくんですけど、なにか ほしい ものが ありますか。(non-past plain verb)
I’m going to Sydney tomorrow but is there anything you’d like (from there)? – I continued the sentence without stopping in the middle.
きのう シドニーに いったんですよ。(past plain verb)
I went to Sydney yesterday (and I want you to ask me why I went there or what I did there…)
わたしは いちごが きらいなんです。(non-past なadjective)
I don’t like strawberries (and I think it is unusual, so ask me more about it…)
きのうの テストは ほんとうに かんたんだったんですよ。(past なadjective)
Yesterday’s test was really easy (and ask me more about it…)
3．Repeating what the other person just said to acknowledge what I have just heard and/or to find out more about it.
A: あの みせの ケーキは おいしいよ。
The cake from that shop is delicious.
B: あの みせの ケーキは おいしいんですね。(non-past いadjective)
The cake from that shop is delicious, is it? (Tell me more about it…)
A: この えいがは おもしろかった。
This movie was interesting.
B: この えいがは おもしろかったんですか。(past いadjective)
This movie was interesting, was it? (and what about it was interesting…?)
Last Saturday, when I posted about the kanji 愛, I quoted a saying “愛は心にノをつけて受けいれること (Love is to accept one’s heart with (the katanana) ノ)” and adding の？ to a statement you have just heard and asking back is a great way of showing that you care. That の is a casual way of saying this ～んです. You can use ～んですか instead of using の？
4. when I want to express my surprise or determination.
In this usage I have to compare with the sentence without んです.
どうしたんですか。(past plain verb) – when I (and most people) see somebody hurt – expressing one’s surprise
どうしましたか。 – when a doctor see somebody hurt – very objective
You had a hair cut!?
かみを きったんですね。 – Implying “I didn’t think you would have your hair cut”
かみを きりましたね。 – just acknowledging that the other person had a hair cut
I want to go there no matter what!
どうしても いきたいんです。 – shows my determination to go
どうしても いきたいです。 – I am expressing my desire to go but not as strong as the above
Most of above examples have the information about what kind of word is used before んです in the brackets afterwards. You need to be careful when you use a な-adjective or a noun in the non-past form. You need to add な before んです。
～んです is not usually used in written documents. In fact, if I type it in MS Word, its spell checker tells me to change it into ～のです. And of course, if you want to end the sentence in the plain form, you can use ～んだ or ～のだ.