Tess of the D'Urbervilles is a tragedy (see "Booker's Seven Basic Plot Analysis" if you don't believe us). But it's not a traditional tragedy, in that Tess's fate is caused not by her own ambition, but by the ambition and actions of others.
So when does Tess pass the point of no return? When does it become impossible (from a narrative point of view) for the novel to have any resolution but a tragic one? Is it when she murders Alec D'Urberville? That pretty much became inevitable when she got back together with him. So is it when she agrees to become his mistress again (a moment that, notably, is never actually depicted)? But that seemed unavoidable as soon as Alec found her again and started harassing her. So was it, perhaps, when Angel left her to fend for herself after she confessed everything to him on their wedding night? But knowing what we know of Angel's character, he couldn't have reacted any other way. So really, it was Tess's rape by Alec that made the tragic finale inevitable, and that, we know, was the predictable outcome of sending Tess to live with him in the first place.
What we're trying to say is that it seems that the whole novel, from the very beginning, is propelling Tess towards her tragic execution at the end. It's like an avalanche of tragedy that all lands on Tess, even though she's not the one who started the slide.
But the final scene doesn't even show Tess: it's like the rape scene, in that Hardy pulls back and describes the surrounding scene, but doesn't give us any details of what's going on with Tess herself. We can only infer what happened based on Hardy's ambiguous, elliptical language, and other signs.
In the final scene, 'Liza-Lu and Angel wait outside of a prison (although Hardy doesn't come right out and call it a prison: he describes the structure as "a large red-brick building with […] rows of short barred windows bespeaking captivity" [59.6]). They don't witness the execution, and neither do we: they wait and watch the building until a black flag is raised on a pole outside the prison tower, at which point the narrator pulls back, and says, "'Justice' was done, and the President of the Immortals (in Aeschylean phrase) had ended his sport with Tess" (59.7).
The first words, "'Justice' was done," are relatively easy to figure out – "justice" has been served, Tess has been executed for murder, and the black flag at the prison indicates to anyone looking up at it that an execution has just taken place. Hardy puts "justice" in quotation marks because, of course, neither he nor the reader believes Tess's fate to be "just" in any real sense.
But the second half of the sentence, about "the President of the Immortals" could probably use a closer look. Hardy claimed that "The President of the Immortals" was his own translation of a phrase from the ancient Greek playwright Aeschylus's tragedy, Prometheus. In Aeschylus, all suffering in the world is a result of the deliberate will and malice of "The President of the Immortals," or the supreme deity. When Tess of the D'Urbervilles first appeared, some critics accused Hardy of personally holding the same beliefs, but he always denied it. Yet to close the novel with that phrase suggests that, in the world of Tess of the D'Urbervilles, at least, it might be true.
The final hitch in the ending of this novel is Angel's potential remarriage to 'Liza-Lu. When they're at Stonehenge, just before Tess is arrested, she asks Angel to marry her younger sister after she dies. Tess seems to know that she's going to be arrested and executed, and she appears to be comforted by the thought that Angel might marry 'Liza-Lu after she's gone.
But this always seems like a shocking proposal: 'Liza-Lu was never a major character, and Tess's proposal seems like it's coming out of left field. Let's look at Tess's reasons for proposing it: she says that 'Liza-Lu has "all the best of me without the bad of me" (58.43). In the final chapter, the narrator describes 'Liza-Lu as "a spiritualized image of Tess, slighter than she, but with the same beautiful eyes" (59.3). So 'Liza-Lu represents a purer, more spiritual form of Tess – perhaps, she's supposed to suggest what Tess could have been, if she had never met Alec. If that's the case, then the potential marriage of Angel and 'Liza-Lu would be at least partial atonement for the tragic way that Angel and Tess were driven apart by Tess's past.
Does this mean that the novel actually ends on an optimistic note? No, probably not – Tess is still executed, and Hardy still suggests that her suffering was due to the malicious will of an angry god: not a very optimistic way to end a story by any stretch of the imagination.