Write whatever you enjoy writing. But, if you want people to buy your writing, it helps to learn about the world of publishing and the market for books. Writers don't need to be experts in this area, but it is useful for them to know what's getting published and by whom, and how much of it there is. And it can't hurt to know which publishing house just went bankrupt.
Read the books coverage in your local newspaper. Find and follow several book blogs. Check out the New York Times Book Review once in awhile. If you have a long attention span, read the New York Review of Books.
Visit your library and ask to see copies of prepublication journals, such as Booklist, Publishers Weekly, Library Journal, School Library Journal, Kirkus, and Horn Book. Or visit their websites. Each one has a particular audience, and knowing the audience is important. Booklist writes primarily for public librarians, for example, and Publishers Weekly for booksellers and the publishing industry.
There are a lot of good, free e-newsletters that can help you get a better idea about what's going on in publishing, too. Try a few.
Insider blogs are another great way to learn about the industry. Blogs by agents and publishers, in particular, can be a great way to learn what not to do.
Written by an agent, most entries consist of clangers from query letters; a great example of what not to do.
More good insider advice from an agent.
This agent blog ceased publication in 2007 but the archives are still there and worth sampling.