At the beginning of part 3 of the dystopian novel Fahrenheit 451 by Ray Bradbury, Captain Beatty takes the protagonist, Montag, to Montag's own house and orders him to burn it down. Montag has been hiding books and reading, and Beatty judges that Montag has gone too far when he reads poetry to his wife and her friends. Montag obeys Beatty's order and sets fire to his house. However, after his house is burned and fallen in, Beatty continues to taunt him. When he finds the earpiece that Faber has been using to communicate with Montag, Beatty says that he will track Faber down and arrest him too. That is the point at which Montag turns the flamethrower on Beatty and burns him to death.
Once Beatty is dead and he has knocked out the other two firemen on the scene and destroyed the mechanical hound, Montag comes to an abrupt realization that Beatty wanted to die.
In the middle of the crying Montag knew it for the truth. Beatty had wanted to die. He had just stood there, not really trying to save himself, just stood there, joking, needling, thought Montag ...
Bradbury does not explain why Montag thinks that Beatty wanted to die. It is not expressed by the author as a definitive fact, but rather as an abrupt realization that Montag comes to. However, if we see it from Montag's point of view, we understand that Montag's life has been completely changed by the books that he has come to read and cherish. He has rebelled against his former life of conformity to the system and has allowed the thoughts he has discovered in books to change his entire way of thinking.
Beatty, too, confessed that he read many books. He made a decision to go in the opposite direction, though. Instead of yielding to the insight that books imparted, he clung to the system that destroyed them. This made Beatty torn between the freedom of thought represented by books and the bondage of ignorance represented by destroying them. His hypocrisy must have torn him apart. He must have longed for death because he could not reconcile what he read in books with the sordid life he was living.
It is also important to consider that when Montag has this realization about Beatty, he has just committed murder. It's possible that believing Beatty longed for death is also self-justification for killing his former boss.