Some of your phrases are correct, some are not, and most of them are not the clearest way to communicate your meaning.
Firstly, the best and most common way to say this is not in your list, which is:
I found out about this song from Mary
Your first sentence is correct, but just OK
It was from Mary I found out about this song
It might read better with the addition of a "that" between "Mary" and "I":
I was from Mary that I found out about this song
Your second sentence is also OK, despite containing a "terminal preposition" where "from" is separated from "Mary" and left at the end of the sentence.
It was Mary I found out about this song from.
It's actually not a strict rule you have to follow, but most people try to avoid stranding prepositions like that, as it can impede comprehension.
Your third example is not correct as written:
It was from Mary I found this song.
It's missing "out about" in that phrase "found out about." It's find to say you "found" a song, but when you bring "Mary" into the picture you can't say you "found it from Mary." It just doesn't work. So basically to make this sentence correct you need to turn it into your first sentence (with or without the "that" I suggested)
Your fourth example has the same problem as your third, and once again adds a terminal preposition.
It was Mary I found this song from.
You don't find a song "from" someone. You find it online, or in a record shop, or in a book -- but you "find out about" it -- that is, the fact of its existence -- from someone, in this case Mary.
Your fifth sentence is more convoluted, and carries the same missing "out about" as three and four:
It was Mary from whom I found this song.
So adding "from whom" is fine, but again you would need the "out about" as in:
It was Mary from whom I found out about this song.
But that sentence, while correct, is not a conversational or convenient way to speak.
Your last sentence, has the same problem as the prior three, but can be easily corrected, as it I did in my recommended answer way back at the top of this post!