"The Devil and Tom Walker" ends when Tom is shouting at his customer, whom he's about to ruin financially to make a profit for himself, even though they are supposed to be friends. When this customer begs for help and points out how much money Tom has already made from him, Tom shouts this:
"The devil take me," said he, "if I have made a farthing!"
The devil is happy to oblige! He shows up with an impatiently stamping black horse, snatches Tom up, and gallops off with him into a thunderstorm. Even more theatrically, they gallop into a swamp, the swamp gets struck by lightning, and it turns into a giant blaze of fire.
There are a few paragraphs after that, as the narrator describes the townspeople's reactions, the mysterious destruction of all of Tom's stuff, and the notoriety of this whole "true" story. But that grand theatrical ending with Tom being carried off by the devil is the real meat of the ending, and it sure is a show-stopper!
Why did Irving end the story in this way?
First, Tom is described as a horrible human being, rotten to the core, greedy and mean and selfish, and hypocritical on top of all that. He's got to get what's coming to him.
Second, Tom entered into the deal with the devil while knowing full well what that deal was, even though it wasn't stated in exact words. He knew he was selling his soul, and so that soul had to be collected by the end of the story.
Third, Tom was warned well in advance by the devil about what would happen if he took what wasn't his and then focused on other people's sins instead of his own. These warnings were issued to him the first time that Tom and the devil meet in the swamp. Because he doesn't pay attention to them, he has to suffer the consequences.
Fourth, you can think of Tom as not so much an individual person but as the embodiment of human greed, wickedness, or hypocrisy. By sending Tom's soul to hell in the story, the author is making a statement about the ultimate result of those terrible human qualities.
Fifth, the ending makes for a great story. The whole time we're reading, we totally hate Tom. He's awful! Look at how he treats his wife, his horses, his friends, and strangers! We can't wait for him to get his punishment, and Irving delivers that to us, making for a gleeful ending.
These are all the reasons I can think of, but others might chime in with more.