There tend to be two camps (and people bounce between them).
Camp 1 writes for the sake of writing, because they want to or have to. They don't really care if they get published, so they don't worry about what's marketable. A lot of the time, this is where those breakout weirdos come from (like Charles Yu, who I love with the burning fire of 10000000 suns).
Camp 2 writes with career goals. They pay attention to the market, learn genre conventions, and try real hard to give readers what they're looking for.