There are two ways in Japanese to make a statement. One is to simply report it, and the other is offered as a means of explanation. んです follows the short form of a predicate, and the predicate can be in the affirmative, negative, past, or non-past. When it follows a noun or a な-adjective, な comes in between.
あしたテストがあるんです。 I have an exam tomorrow (so I can't go out tonight.)
トイレにいきたいんです。 I have to go to the bathroom (so tell me where it is.)
〜んです can be used in questions to invite explanations and further clarifications. It is often used with question words such as どうして and どうした.
Why did you break up with your boyfriend? (You've got to tell me.)
Oh, him. He never takes a bath. (That's a good enough reason, isn't it?)