Once you've written your book, you may have a few lingering questions like whether the one passage you wrote about your ex is legal, or whether you need to get permission for the article you've included. This is where prepublication review comes in. Attorneys review your manuscript for, among other things, potential copyright and trademark law violations, libelous statements, or any potential right of privacy violations.
Attorneys will look at whether you can make a fair use argument for the copyrighted material you've taken or whether you need to get permission. Or whether it's best to take out any passages. Trademark issues may consist of whether consumers may believe there's a false association or endorsement by you and the brand you're featuring (for example, if you've written a book about a licensed entertainment franchise).
Attorneys also review whether anything you've written can amount to libel. Libel is a false statement of fact that you publish that damages a person or organization's reputation. Relatedly, attorneys will review if anything you've written may violate someone's privacy (for example, portraying someone in a false light or publishing private facts that are not newsworthy that is highly offensive to a reasonable person).
Also please note that just because you've written a novel doesn't insulate you from potential libel or right of privacy claims. You can still be sued. So if you're in doubt, contact an attorney near you to review your manuscript.
I hope this helps in understanding how publishing attorneys can better help you avoid common legal pitfalls.