Why does Roy spare Deckard at the end? The whole film, Roy is trying to extend his lifespan. Why? Because he doesn't want to be a replicant. He wants to be more than that; he wants to be human. And for most of the film, he sees his built-in end-date as the barrier to that. https://twitter.com/briebriejoy/status/1291263454972719104
When Roy confronts Tyrell, he learns that this is impossible. There is nothing he can do. On a very basic level, with nothing left to live for - the possibility of "more life", as he puts it, foreclosed - he has no reason to care whether Deckard lives or dies.
So, no longer bound to the ambition that has given him meaning and purpose up to now, he lets something else take its place: empathy. And by doing so, he finally achieves his goal: all along, it was empathy, not lifespan, that marked the boundary between human and replicant.
At least - it's clear that humans themselves see empathy as the defining feature of humanity; hence the Voight-Kampff machine at the start of the film. But therein lies the whole irony of the film, and what makes it so great.
Because although the humans see themselves as uniquely empathetic relative to replicants, we never see any real examples of human empathy in the film (barring Sebastian - the most replicant like human we see).
The whole film is hammering us over the head with the idea that in this future society, empathy has been entirely stripped away by modernity; by technology; by systems of control. This is what makes it dystopian - not the aesthetics.
The book is even more explicit on this point. There's an entire VR-based religion built around the idea of compartmentalised empathy through vicariously experiencing someone else's suffering.
And you can look at Dick's own relationship (real and imagined) with the surveillance state to understand this more. So much of his work is about the consequences of stripping away the humanity of others, and the toll that takes on one's self.
Projecting forward what he saw around him in the America of the 60s, Dick was arguing that in the future, humanity would give up the last shreds of its empathy. By building replicants - simulacra of a human form - we completed the transformation of ourselves into simulacra.
So when Roy demonstrates empathy by sparing Deckard, he becomes - not human, but what humans once were. And this is the one shred of optimism in the film; that maybe, just maybe, our creations will be better than us.