Specifically, in the expression 好きなんだ (I love you) why not just say 好きだ or 好きです?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
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:
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:
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 "好きだ".