1/ Build an audience. Start two years before you start writing your book. 1 year if you are prolific and know how to build an audience. Audience building is a separate topic, but at the core is creating content around your chosen themes and finding people who find that valuable.
2/ Move that audience to an email list. Because social media algorithms keep changing and you may or may not get reach for what you want. An email list is your best bet.
3/ Ask what they want. This won’t work if you don’t have any audience or a small audience. For example, five people will respond if you only have 100 people in your audience and you ask them a question. This ensures that you will write a book that your audience likes.
4/ Create content that people want to read. Write articles and social posts and see how well it is landing. Their comments and replies will tell you this.
5/ Starting work on your book. Take into account what your audience and future readers told you.
Hope this helps as you write your book.