The lyric referenced is from "I Will Survive" by Gloria Gaynor (1978):
"At first I was afraid, I was petrified... / But then I spent so many nights thinking how you did me wrong / And I grew strong / And I learned how to get along."
The line "dance if you want to" is not in the song; the theme is empowerment after a breakup.