Developmental editing is the art of looking at a manuscript to identify big-picture concerns. For nonfiction, this would include helping an author make a clear argument; showing an author how to reorganize disorganized material; pointing out where they need to support the points they make with data, examples, and/or case histories; making sure terms are defined; and so on
For fiction, a developmental editor looks for problems in plot, including implausible plot events and timeline errors; character development, including the overall character arc; a central conflict that does not provide sufficient narrative drive, and so on.
In developmental editing, typically the editor shows where the problems are occurring and offers solutions, but does not do any of the actual rewriting.
Book doctoring goes far beyond developmental editing into actually rewriting the manuscript (whether fiction or nonfiction). You may work with a developmental or acquisitions editor who defines the problems to be solved, but in other instances you may be the one both identifying the problems and fixing them.
The main difference between a developmental editor and a book doctor is in who does the actual revision. In development, that’s the author. In book doctoring, that’s the book doctor.
A ghostwriter is someone who writes a book (whether fiction or nonfiction) for another person, who publishes it under their name. This is common in fields like celebrity memoir. The ghostwriter is usually uncredited (their name does not appear on the cover or anywhere else).
A coauthor is someone who writes a book with someone else. Usually coauthor pairs include an expert and a writer, but they can be two experts, if both experts are competent writers. In most coauthoring situations a developmental editor takes on, the developmental editor is the writing expert and the other author is an expert. In this case, coauthoring can be very similar to ghostwriting, except that your name will go on the cover/in the byline.
All of these roles—coauthor, ghostwriter, and book doctor—are more common in nonfiction than they are in fiction, although that doesn’t mean that such opportunities don’t exist in fiction. (They do.) All of these fields are highly competitive and difficult to break into because they can be very lucrative roles. But it is quite possible for a developmental editor to encounter opportunities for all of them.
See Editorial Toolkit: Book Doctoring and Ghostwriting for more about how to offer these services.