The writer's job is to create characters that are full of interest (and ambiguities are a wonderful way of doing this as they keep the reader guessing. I hoped all through the Harry Potter series Snape would end up being a "good guy" but it wasn't until the very end of the series the answer to that was given).
The crucial thing is to have a strong plot with the right characters in them. You can put the most interesting character in a dull narrative and it will kill the story. Likewise the most wonderful plot but characters not "up to the job" of fulfilling that plot will also kill off the story.
So character portrayal then, I think, is the most important thing for the writer to get right. You've got to know your character well enough, how they would react in a crisis, how they normally are, what their weaknesses and strengths are. The plot has to make sense too and be gripping enough to make readers wnat to read on and keeping them guessing is the classic way of doing that.