Kesha: I sat around praying that one day my new song would come out
Kesha says she wasn't sure that her new song would come out after years of legal battles with her former producer Dr Luke.
The US singer says she finished Praying a year ago, but didn't know if she'd legally be able to release it.
Talking to Nick Grimshaw on the Radio 1 Breakfast Show, she said: " I've been sitting around and praying that one day this would come out.
"There were times I didn't know if it was going to."
Dr Luke, who's also worked with Katy Perry, Miley Cyrus, Kelly Clarkson and Nicki Minaj, initially sued Kesha for breach of contract in 2014.
She countersued accusing him of sexually and emotionally abusing her, something he has always denied.
Kesha is still tied into a multi-album deal with Sony, and says this has been a hard record to write.
"I would get up. I would get in my car, and I would drive to the studio in my pyjamas, and I would lay in a hammock and cry and write a song.
"Then the poor producers I worked with would have to listen to me weep.
Warning: Third-party content, may contain ads
"But at the same time, I think if you listen to the record, I got a lot of that out of my system at the beginning. Once I'd got done weeping, then I got back to myself."
Kesha's third studio album Rainbow, the follow-up to 2012's Warrior, will be released on 11 August.
She says she hasn't had to please anyone else, other than herself, this time round.
"I went through a lot of stuff and I just wanted to start at ground zero and see what happened, not try to live up to anything, not try to be anybody, not try to please anybody else. So I've made a record I'm super-pleased with.
"It's my gift for my fans because they've been unbelievable over the past couple of years. I don't know what I would have done without them.
"They've been unwavering every single day. I get the most beautiful messages from all over the world and this record is dedicated to them.
"It's for my soul, dedicated to them."
Earlier this week the 30-year-old singer wrote an essay documenting her struggles with depression, anxiety and an eating disorder.
"This song is about coming to feel empathy for someone else even if they hurt you or scare you," she wrote.
Kesha says she's really proud of her new music after the pain of the last few years.
"I feel like this music is the most proud I've ever been of anything I've ever done in my entire life, which is so exciting to say," she said.
"They [her tracks] were like my children, and I had so many of them. I had to pick and choose my favourites. I had the best kids on this record."