Every writer has her own habits and strategy, and there are many books on the topic. How to produce a clean manuscript is another matter. It starts with a word-processor and printer. Given the ubiquity of cheap computers and good word-processing programs, there is no excuse for spelling errors, inconsistent formatting, or unnumbered pages. Furthermore, publishers want the digital file.
Most publishers tell their authors exactly how they want the manuscript to be formatted.
Self-editing is an art. Most authors learn how to do it by trial and error. Reading print-outs at regular intervals with a pen in hand is a good idea, and some writers find it helpful to read their words aloud. More important, probably, is finding helpful readers. If the book is meant for a general audience, it's good practice to find a general person or two to read it as it's developing.