When singer-songwriter Kesha was approached by DJ/producer Ryan Lewis with the raw track that became her hit single “Praying,” the prospect of a co-headlining tour with his collaborator Macklemore was not likely foremost on her mind. The singer was preparing to work on the songs that would become her 2017 album Rainbow when Lewis contacted her management about working together. Lewis had sketched out the track during Macklemore & Ryan Lewis’ 2016 This Unruly Mess I’ve Made Tour, before the longtime friends went on hiatus as a duo in order to explore solo paths and grow as artists. It wouldn’t be long before both Lewis’ and Macklemore’s paths led to Kesha.

Kesha was refocusing creatively after a bitter, heavily publicized court battle with former producer Dr. Luke had drained her energy and left her with less of an appetite for party anthems such as her 2010 breakout hit “Tik Tok.” Newly empowered after freeing herself from contractually having to work with Dr. Luke, against whom she had leveled allegations of sexual and emotional abuse, the singer-songwriter was exploring more mature themes. Lewis’ gospel-tinged ballad fit the bill, but Macklemore was laying the foundation for his first solo album around the same time. By January 2017, Macklemore hinted on Instagram he and Kesha were working together.

The result, “Good Old Days,” became the third single from Macklemore’s solo effort Gemini, which was released in September. Macklemore kicked off a tour as a solo artist, and released the songs “Glorious” and “Marmalade” as singles that fall. The album reached No. 2, matching the success of Macklemore & Ryan Lewis’ 2012 debut album The Heist. “Praying” became the lead single for Kesha’s album Rainbow, which was released a month prior to Gemini. The album also features the cathartic “Learn to Let Go,” and assertive “Woman,” which was brassed up by the Dap-King Horns.

Both Eagles of Death Metal and Dolly Parton also guested on Rainbow, with the latter adding her vocals to “Old Flames (Can’t Hold a Candle to You),” a song written by Kesha’s mother, Pebe Sebert, that was previously a No. 1 country hit for Parton in 1980. That song would not make the set list for The Rainbow Tour, but both Eagles of Death Metal collaborations, “Let ’Em Talk” and “Boogie Feet,” did during a concert trek that found Kesha having to cancel a few spring dates in Asia and the South Pacific after she injured her knee during a Feb. 9 performance in Dubai.

Macklemore managed to avoid injuring himself during the Gemini Tour, finding himself the recipient of good fortune instead when he and his wife welcomed a second daughter into the world in March. He found a new friend in Kesha after “Good Old Days,” forming a relationship solid enough for the two to tour as co-headliners for the 30-date The Adventures of Kesha and Macklemore summer tour. By mid-May, they had not disclosed whether Kesha would join Macklemore onstage for “Good Old Days” or whether Lewis might be in the house for “Praying” during one of the shows, but those prospects are likely foremost on ticketholders’ minds.

Mandalay Bay, 7 p.m. June 9, $39.50-$125 plus tax and fee. 800.745.3000 Ticketmaster