The Mayor of Casterbridge is, as we're sure you've realized, a novel. But what exactly is a novel? It's one of the loosest categories out there, and yet it's one of the most popular genres of literature.
A novel is a work of fiction, usually written in prose, as opposed to poetry. It's usually pretty darn long, and it's generally divided up into chapters or volumes. OK, sounds like a decent description of The Mayor of Casterbridge.
To be more specific, The Mayor of Casterbridge is an example of we call "Literary Fiction." The narrator is very interested in plumbing the psychological depths of the characters and in portraying human emotions and motivations as realistically as possible. The actual plot of the novel is less important than the way the characters develop.