Specifically, in the expression
好きなんだ (I love you)
why not just say
Japanese Language Stack Exchange is a question and answer site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language. It only takes a minute to sign up.Sign up to join this community
It's hard to answer this specific question without getting into the more general topic of the ～のだ construction, which, as jkerian mentioned, can mark an explanation for a certain context, which may be either explicit or implicit. Put succinctly, ～のだ provides supporting information. This information is often a reason, but it may be a cause, basis, conclusion, restatement, or confession. Because it is supporting, ～のだ tends to shift the focus away from the information it marks. (This is in contrast to ～から, which often draws more focus toward the information it follows.)
(Bill Nye voice) Consider the following:
A: (1) You weren't in the office last week, were you? (2) Did you go somewhere?
B: (3) Yeah, I traveled with my family to Nagoya.
A: (1) 先週、会社にいなかったね。 (2) どこかに行ったのか。
B: (3) うん、家族で名古屋に旅行してきたんだ。
In sentence (2), A asks a question with ～のか, the question form of ～のだ. This connects the question to sentence (1) and shows that the answer to the question will provide a basis for the fact that B wasn't in the office last week. (Sentence (2) could actually be left out entirely. In this case, B may anticipate sentence (2) as an unspoken question and answer with the exact same sentence (3) as above.) In sentence (3), B provides the supporting information that A is looking for, and since it is supporting information, it is marked with ～のだ (～んだ in speech).
From an English perspective, a sentence without ～のだ looks exactly like one with ～のだ, because in English we tend to leave these inter-sentence connections unspoken. This is part of why the ～のだ construction is difficult to grasp. You could theoretically force an English rendition, but at the expense of naturalness:
A: (1) You weren't in the office last week, were you? (2) [Is this] because you went somewhere?
B: (3) Yeah, [I wasn't in the office] because I traveled with my family to Nagoya.
Now from general to specific. In your question, it's difficult to say why the speaker would use 好きなんだ over 好きだ, since we have no context. But ～のだ is often used in confessing something the listener would have a hard time knowing. (This also counts as supporting information, since its purpose is to fill in a gap in the listener's understanding.) So 好きなんだ would be preferable to 好きだ in that context:
好きなんだ is better here because the first half raises a question in the listener's mind (What hasn't she been able to say until now?). Since the second half is designed to anticipate and answer that question, it's marked with ～んだ. 好きだ would technically convey the same information, but without の/ん you lose that connection between thoughts and the sentence doesn't flow as well in Japanese.
なんだ is a pattern that is sometimes called the "extended predicate". The exact best way to express this in English is subject to debate.
Usually the usage follows a pattern of explanation of some question that either has been asked explicitly or could be asked implicitly. For example, if A-san is telling B-san that s/he wants to go with B-san to Tokyo, "好きなんだ" provides an explanation of why A-san wants to go.
My personal choice of translating this is to use the form "It's that..." or the longer form "It is the case that...". Although this is not a precise translation, but in some contexts it provides a workable distinction from the translation of the more direct "好きだ".
I also would like to add my information gained from my teacher at college. He says while the above explanation describes in great details in what context we use 「んだ」 or 「のだ」, basically it cannot be translated as the expression of cause, basis, conclusion, restatement, or confession. According to his academic research on Japanese language 「んだ」 or 「のだ」only accidentally explainable with these meanings, since 'cause, basis, restatemen and confession' aren't expressed by them, but by the actual questions and answer pairs. He says the real function of 「んだ」 or 「のだ」 regards the style of speech rather than the content. The grammar in question is like the use of arms in martial arts when we fall to the ground to blunt the power of the drop. According to his findings, these sentence ending structures have the same function, to blunt the edge of the question - for example - if we accidentally conjugate the sentence ending verb into a short form.