Questions which end in ~のですか are used when one sees/hears something unexpected and wishes to confirm one's interpretation or conjecture about the reason/cause behind it. This question asks for an explanation for what one sees/hears, so it is often used with the interrogatives どうして and なぜ(why?). Statements ending in ~のです are used to try to explain one's behavior or a particular situation. For non-past affirmative na-adjectives and nouns, replace だ of the plain form with な.
A: どうか したのですか。
What's wrong?/What happened?
B: きっぷが ないのです。
I can't find the ticket.
A: マナさんは どうか したのですか。
Is something wrong with Mana?
B: おなかが いたいと 言って ねて います。
He is in bed, saying he has a stomachache.
A: きれいな ようふくを 着て いますね。どこかへ 行くのですか。
You are dressed nicely! Are you going somewhere [special]?
B: これから パーティーへ 行くのです。
[The reason is that] I'm going to a party now.
A: あまり おかしを 食べませんね。きらいなのですか。
You don't eat sweets much, do you? Is it because you dislike them?
B: いいえ、きらいなのでは ありません。はが いたいのです。
No, it's not that I dislike them. The fact is, I have a toothache.
A: マナさんは 元気が ありませんね。病気なのですか。
Mana looks depressed, doesn't he? Is it because he is ill?
B: いいえ、病気なのでは ありません。テストが できなかったのです。
No, it's not that he is ill. The truth is, he didn't do well on the test.
What can I do for you?
I feel dizzy.