As a reader, historical fiction is a story with both fiction and non-fiction mixed together to create a good story which draws the reader into the action and the time period. Good historical fiction requires a great deal of research to create the minute details which are true and which give the made up parts of the story the background of reality. Learning history through historical novels is not really a way to learn history, but to learn the small parts of history or the time period. There is no particular template for historical fiction which means only the facts used can be verified and the reader must be wary of which are facts and which are fiction. The reader can learn about the time period of the story and historical facts in a fun way which makes it more enjoyable for the reader. The biggest issue of historical fiction is for the reader to know which is fact and which is fiction.
People are usually interested in history. History is also full of great stories. People know something about history, but they want to learn more. When you combine these elements you have a real winner. People love historical fiction because they know something about the time period anyway and they want to know more.
Real historical events or details are used in fiction to create verisimilitude. The use of bits and pieces from history can make a story believable or make it seem real. This, in turn, may lead the story to have a stronger impact than it might otherwise have (with a lesser semblance of reality woven into the story).