Explain the background
んです adds a “that’s why” or a “you see” — you are explaining something, not just stating it.
explain why you're saying it
まったんです is “I waited, you see” — the same まった as ever, said as an explanation. After a noun or a な-adjective it comes out as なんです: かしゅなんです “she's a singer, that's the thing”. Ask かしゅですか and you are asking outright whether she is a singer; ask かしゅなんですか and you have already worked it out and want it confirmed: “so she's a singer?”
Tips and Common Traps
んです is what you reach for when the other person is missing a piece — the reason, the situation, the thing that makes what you just said make sense.
In casual speech んです becomes んだ: まったんだ (I waited, you see). Go easy on the 〜んですか question when nothing suggests anything has happened — it lands like an interrogation.