In May 2007, she produced a mini-tour for the House of Blues just after she left a rehabilitation facility under the name The M+M's; with six shows altogether, she sang live during some lines of her songs. She recorded her latest album with producers such as Sean Garrett, J. R. Rotem and Nate "Danja" Hills throughout 2006 and 2007.
In September 2007, the official findings in Spears's custody battle were announced by the court. She was ordered to undergo random drug and alcohol testings and to attend parenting counseling. Spears and Federline continued to share joint custody of their two children on a conditional basis. A few days later, she was officially charged with misdemeanor hit-and-run and driving without a license. If convicted, she could face a year in jail. Spears lost physical custody of her children to Federline on October 1, with the court ruling that Federline will keep full custody of the children. The charges for her alleged hit-and-run that occurred in August 2007 were officially laid, she was booked for the charges by the Los Angeles Police Department on October 15 but was not arrested.
The release of Spears's fifth album, Blackout, was rescheduled to October 30, 2007 rather than November 13, 2007 due to online leaks. Blackout debuted at number two on the U.S. Billboard 200., making Spears the only female music artist to have her first five albums go to number one and two. It was fairly well received by critics. As of June 2008, there have been 3.1 million digital downloads of the songs and remixes from the album in the United States. Rolling Stone gave the album 3.5 out of 5 stars. Allmusic also rated the album 3.5 out of 5 stars, calling Blackout "coherent and entertaining" and stating that "it holds together better than any of her other records". Blackout's lead single, "Gimme More" leaked on the internet on August 30. The song, which was Spears's first produced by Danja, peaked at number three on Billboard's Hot 100 on October 3, making it her most successful single in the U.S. since her debut, "...Baby One More Time". Spears's highly anticipated performance of "Gimme More" at the 2007 MTV Video Music Awards was panned. The BBC stated that "her performance would go down in the history books as being one of the worst to grace the MTV Awards", and The Times noted that "Spears was out of synch as she lip-synched and at times just stopped singing altogether". Despite the criticism on her performance, the single has achieved worldwide success. The second single, "Piece of Me", was certified platinum in the US.
2008-present: Conservatorship, custody settlement and Circus
On the evening of January 3, 2008, after not sleeping for over four days, Spears refused to relinquish custody of her children to Federline's representatives. In response, police were called to Spears's home. She was hospitalized at Cedars-Sinai Medical Center after she "appeared to be under the influence of an unknown substance", though blood tests tested negative for any illicit substances. She was held for psychiatric evaluation for two days. Pending a February 19 hearing, Commissioner Scott Gordon issued an order on January 14 stating that her visitation rights have been suspended indefinitely. On January 31, a court placed Spears under temporary co-conservatorship of her father James Spears and attorney Andrew Wallete, giving them complete control of her assets. As a result of an order placed by her psychiatrist, she was taken to UCLA Medical Center to be put on a 5150 involuntary psychiatric hold for the second time that month. On February 1, a restraining order was issued against Sam Lutfi, a prominent figure in Spears's life. She was released from the hospital on February 6, amid speculation that she has bipolar disorder, although medical records are classified, and no confirmation has been made. Her parents expressed disappointment and concern at the decision to release her. She has regained some visitation rights after coming to an agreement with Federline and his counsel. On July 18, 2008, Spears and Federline reached a custody settlement in which Federline retains sole custody while Spears keeps her visitation rights. Conservative pundit Rachel Alexander pointed out in an article that Spears' support for the president partly caused the feminists in the United States unwilling to defend her in her child custody controversy.
In 2008, Spears guest-starred on CBS's television show How I Met Your Mother playing a receptionist. She received positive reviews for her performance as well as bringing in the series' highest ratings ever. Spears reprised her role in May 2008, leaving the storyline open for a future return.
On September 7, 2008, Spears opened the MTV Video Music Awards for the third time. Although having not performed, a skit with Jonah Hill was pre-taped, as well as an introduction speech to the official opening of the show. Spears won Best Female Video, Best Pop Video and Video Of The Year for "Piece of Me".
On September 15, Jive released a statement announcing the title of her sixth studio album, Circus as well as the first single, "Womanizer". The single was released to radio stations on September 26, and the release date for the album