How to achieve it? Writing something really good, something of undeniable (among those who have critical faculties) literary merit is recommended only for those with a long-term, indeed post mortem, view. If you don’t much mind if few people read your stuff now, so long as some people are still reading it in a hundred or five hundred years, then that’s the way to go.
But most people would like to be rich and famous sort of now-ish, and then there are two routes: the older and more difficult one is to get your book banned, or anathematised, or otherwise strongly disapproved, by some, usually nominally religious, organization or other. The Roman Catholic Church used to be a good bet: write something that would get your book on the Index Librorum Prohibitorum, or at least the Index Librorum Expurgatorum. This would ensure huge sales at least in the world’s very large Roman Catholic population. In Greece, you could annoy the Orthodox Church; with any luck they would not only try to ban your book, they might anathematise or excommunicate you yourself. Nikos Kazantzakis had great success like this, and so did the lesser-known Kephallonian writer Andreas Laskaratos. A more recent and more dangerous route is to annoy certain powerful people who claim to be Muslims. Salman Rushdie went this way and very nearly got killed, but it ensured very high sales for what is by no means his best book.
An easier method is to use money, and it is by far the most common way now, being done routinely every day: You, or rather your publishers, pay a bribe, often quite large, to Waterstone’s and, entirely regardless of your book’s literary merit, they put it in the window and on the table just inside the entrance. (No doubt Amazon has a similar bribe-taking system.) People with no taste or discrimination, i.e. most of the people who go into Waterstone’s in the first place, will eagerly buy it because it is a ‘Best Seller’. (It is a ‘Best Seller’ because it's on the front table and people with no… yes you’ve got the idea.)
As I say, that is the easier way, especially if you have lots of money. No doubt something similar operates for films, so it’s a touch surprising that Sony, or is it Disney, have opted for the old ‘disapproval’ route to get huge numbers of viewers and potential viewers of their dire piece of idiocy about an American plot to kill the pompous, paranoid, and murderous buffoon who runs North Korea.