There are multi-year college level courses to answer this question. But I’ll try to give you a brief answer. 1. First you need a good idea and some ability with language. 2. Then you need to dedicate time each day to writing and revising your idea until slowly it evolves into a marketable manuscript. 3. Finally you need a publisher who believes in your book as much as you do. The publisher does the work of actually publishing your book for you and distributing it. It’s hard work, it’s collaborative work, it’s joyous work, it’s heartbreaking work; it’s exhausting, consuming, and the odds against making any kind of profit are unimaginably high, but if you have a bit of grit, a love of language, a familiarity with story shapes, a story to tell, and a fair measure of luck, you might be fortunate enough to publish a book some day. Good luck!