〜のだ, 〜んだ
Presenting something as the explanation: of what came before in a story, or of the situation in conversation.
Make a card in yomerooのだ (のです, and casually んだ) after the plain form presents a sentence as an explanation: not just "X happened" but "the thing is, X". It ties the sentence to something the listener or reader has already seen and doesn't yet understand.
It follows the plain form: verbのだ, い-adjのだ, nounなのだ, な-adjなのだ.
Usage 1: explaining, in a story
Narration uses のです and のでした to explain what happened, often after a character has misunderstood it. The child fox runs in crying that something is in his eye; then the narrator explains:
And closes the explanation by going back to the child's mistake:
のでした can also wrap up a scene as a whole, "and that was how it was", rather than answer a question:
Usage 2: んだ, in speech and thought
In conversation のだ is usually んだ. It explains (あれは町の灯なんだよ, "that's the town's lights, you see") or, in instructions, insists: 探すんだよ, "you look for…".
In someone's thoughts, んだな is working something out: "so that's it".