Read a lot. Reading the kinds of books you enjoy and find useful will help you write the kinds of books other people will enjoy and find useful. Read the biographies and autobiographies of writers you've admired. To me, there's nothing more inspiring than to learn about the challenges faced by other writers during their lifetimes and how they overcame them. Okay, I lied.
Different things work for different writers.
You have to do what works best for you and for your book. There are tons of books out there about writing. But, as I said, don't spend too much of your time reading how-to books. Although it's helpful to have a couple of references on writing, the best way to learn to write is to just sit down and do it. The more you write, the better you'll get.