Whats the difference between なんで日本語を話せますか vs なんで日本語を話せるのですか


What I understand is that the の is used when an explanatory tone is needed,
but is there anything fundamentally different with these statments and which
is used when?




The former, なんで日本語を話せますか, is plain unnatural, and you should always construct
a sentence like the latter. A good rule of thumb is that なんで/どうして is almost
always used with explanatory の/ん.

Exceptions:

  * Short questions like "なぜか?", "なんでですか?" and "どうして?" do not require の/ん. (Although it's common to add な/の like "なぜなのか?", "なんでなんですか?", "どうしてなの?" The difference is very small.)
  * In an [embedded question](https://japanese.stackexchange.com/q/13034/5010), の/ん is not required.

