I'm having trouble understanding the grammar of this sentence:
I understand it means, "Its fun to dance," but I'm struggling to understand why の is placed here: おどるのはたのしいのです。
It's something called an explanatory-の.
So the last の turns "It's fun to dance" into "It's that it's fun to dance". This の is a kind of a nominalizer that wraps everything before it and forms a noun clause.
Note that you need some context for this sentence to make sense. For example, when the listener is wondering why you're dancing, you can say this to explain the reason.