Many writers, particularly those who self-publish, believe that genre has nothing to do with them. They write what they write and refuse to follow the “rules.”
What most don’t realize is that genre is not so much about following a particular formula as it is about finding the right market and readers. Publishers and Amazon want the writer to know the correct genre to insert their book in to because they know that that’s how the readers find the books they will enjoy.
Nothing makes a reader madder than reading a book labeled as a romance where one of the romantic pair dies instead of offering a possibility of a “happily ever after.” Or a mystery where the bad guys win or the murder isn’t solved. This fails the promise made by the genre label.
How do you determine your genre or decide what genre you want to write?
One of the first things you do is consider the books that are similar to what you are writing. What genre are they listed as? Pick books that are from traditional publishers since some self-pubs haven't a clue about their genre or they slap on a popular genre to attract more readers.
Once you have some clue about the genre or genres to look at, do some searching of terms. If you think you may be writing urban fantasy but several searches and reading of articles on urban fantasy tell you that you aren't, do some more searching for terms like "contemporary fantasy."
As a starting place for finding good writers to read in a particular genre, go to a site like RTBookReviews and read a bunch of reviews to find books similar to yours. Pick the writers who are recommended reads. It's best to pick writers who aren't "names." Nora Roberts can do what she wants because she's Nora Roberts so she's not the best example for the books you want to emulate. Neither is Stephen King or James Patterson.
If you discover that you have done very little to no reading in a particular genre, you need to rethink your book because you will open yourself up to writing cliches, annoying readers, and making massive mistakes that will destroy the book's market value.
Genre distinctions are a particular interest of mine so I have a number of articles on the subject. Click on the "genre" label on the right side of this blog. If you are writing a mix of genres (cross-genre) or a subgenre of a popular genre like romance, click on the label "cross genre."