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. And it's always worth soliciting criticism from other experts and writers. Agents and editors are immediately turned off by typos and usage errors.