The sage advice to authors is "write what you know." In order to do that, Dick Francis learned how to fly and earned his pilot's license so he could write authentically from a pilot's perspective. As a ghostwriter, I find myself using my own experiences to correct inaccurate assumptions made by clients in their plot outlines.
For instance, one client had his hero leading his military team through a cave system. They held hands. Wrong. I've been spelunking once. That was enough for me to enjoy the experience and know that it's not something I care to repeat. To be blunt, no one the spelunking expedition held hands, impossible to do when the experts instruct that one should always have three points of contact when crawling through a cave. I also informed the client that the darkness below ground is absolute; anyone traveling through a cave system must bring in a light source: if you're not wearing it, then you're carrying it.
Another client specified a certain kind of cartridge or bullet for her science fiction adventure. In the original draft, the guns emit the smell of cordite from gunpowder. However, the client did not want gunpowder--too old-fashioned. I then explained that something must compel the bullet--whatever its composition--from the chamber down the barrel and into its target. That requires some sort of combustive force. I ended up using an electrical spark to ignite the contained explosion that propels the bullet.
However, I'm not the one who imparts all the instruction. I learn from my clients. One client's historical novel relies on his diligent research, so now I know that the State of California had a Department of Education long before the USA did. His research and mine tend to supplement one another. Because of this client, I also know now of some of the more interesting sites in Prague, which I'd like to visit if I ever manage to travel to the Czech Republic.
The most entertaining part of "write what you know" occurs when I read a book in which the author obviously didn't conduct any research whatsoever. I read a romance in which the heroine raised alpacas and combed them, picking the loose wool from the combs. That might work for gathering cashmere, but that's not how we obtain alpaca wool. Three minutes of online research would have cleared that confusion. (By the way, we shear alpacas, much in the manner that we shear sheep.)
Livestock and farming tend to trip up authors with regularity, from hunky and bare-chested male characters baling and stacking hay to characters brand new to riding receiving tutelage in galloping their first time in the saddle. I recently responded to an author who decried the use of guns and saw no value in them except as blunt forces bullies used to command respect. "Don't confuse fear with respect," I cautioned and stated reasons why "the great equalizer" could come in handy.
Probably the most annoying of "write what you know" failures occurs in scenes depicting intimacy. When one sees my head tilting to one side and my hands turning the book, one knows that I'm trying to figure out how the lovers in the book did whatever it was they were doing. Simply put, the author's knowledge of anatomy could bear improvement.
"Write what you know" need not mean that the author must not write about what he or she has never experienced. It means that the author must conduct the necessary research for adequate understanding and to inject realism. If you're writing, then you can count on someone who reads your work to see the mistakes. Oftentimes, readers are generous enough to overlook small glitches; however, don't count on it. The more basic the error, the less forgiving the reader will be.