Thanks to all for a brilliant discussion of well-known books set in England. Now I am moving north...
Scotland is a case where the answers are somewhat confusing.
First off, I will ruthlessly ignore the seven Harry Potter novels, even though Hogwarts is supposedly in Scotland. Apologies to Scottish Potterfans, but I think that for most readers they would fail the test of "If you were asked to name five books set in Scotland, would any of the Harry Potter books have been one of them?"
The most popular book on LibraryThing which is set in Scotland is also the second most popular on GoodReads set in Scotland. It's also one I happen to know quite well. It's not a novel, nor a non-fiction work. It's set 450 years before it was written and bears very little resemblance to the historical events it supposedly describes. But it certainly passes the "think of a story set in Scotland" test. It is:
Macbeth, by William Shakespeare
However, more popular on GoodReads, and almost as popular on LibraryThing - and crucially, by far the most frequently tagged with the keyword "Scotland" on both systems - is a book that I, frankly, had not heard of:
Outlander by Diana Gabaldon
Published in 1991, it is the first of a long and successful series of time-travel romance novels, which were adapted for television in 2014. I welcome views from you as to whether or not I should remedy my ignorance of this work which is so close in popularity to the other work named above.
Trainspotting, Kidnapped and The Wasp Factory (all of which I have read) are some way behind.
Edited to add: I am retrospectively declaring the play rather than the fantasy novel the winner here. The first time round, I neglected to count the various different collections that the play appears in, which will pull it decisively ahead on Goodreads.