Buffy had one, Lexx, and Fringe also had them, even if it’s just three corpses singing Mr Sandman…
They seem to be one that is, almost, a filler episode that doesn’t advance the plot but it does make some light hearted relief from the series.
It gives the chance for the cast to show-off, or not depending on how well they can Sing. They will have varied amount of time singing. It depends on how good they are. Buffy is a great example of this.
The other series that has a musical episode is Lexx. The second series episode, Brigadoon is that one. One of the maincast, Kai (Michael McManus), does most as he, probably, has the most skill.
The episode is more a back story of the character as a musical play. All the singing is done on stage as well!
The lyrics are terrible and the rhymes are even worse but it is silly and you may even have to catch yourself singling along as they are a catchy in places!
Buffy’s attempt is, possibly the first that used this as an idea. If it isn’t, it definitely is the best known of musical episodes. I still have some of the lyrics stuck in my head that appear occasionally. Normally about bunnies!
Buffy and Lexx’s musical episodes do share one thing in common. At least one of the songs are talking about a character’s back story. One the main character [going through the motions] and the other, almost the main one [the whole episode].
Other series have musical numbers in. Futurama with How Hermes Got His Groove Back or Hell is Other Robots are two from that series. They don’t count as it’s just a song in the episode and not a musical episode.
In conclusion then. Musical episodes are great fun and can give a nice break to a series. They don’t move the plot onwards but it makes a nice, memorable episode nevertheless.