The protagonist of 'Nightcrawler' is motivated, clever, and a sociopath — and despite him taking unforgivable actions, the audience stays engaged in the story. Why?
If you take away the details and paint both films in broad strokes, Damien Chazelle’s 'Whiplash' and Darren Aronofsky’s 'Black Swan' are pretty much identical.
At its most basic level, a story is simply information being communicated over time. 'Ex Machina' is a great example of how a screenwriter's ability to carefully control a story's information can make for a compelling film.