Different situations are different. Sometimes kids throw a tantrum because they have a disappointed desire (aka, the movie is over, time to turn off the tv; or, that's enough dessert, time to be done; or, we have to stop playing and put our toys away because it's time for bed; or, no we aren't going to buy that toy). Other tantrums are the result of a disappointed expectation ("I thought grandma and grampa were coming over over right now; I thought we were having Mac n cheese for dinner!"). And some tantrums are the result of increased particularity due to exhaustion ("You're touching my blanket!; Dada took a bite of my French fry!; I need my cup to be facing exactly this direction!; no music!").
With tantrums of the first type, if my son is too worked up to listen, I start with, "Do you need a timeout so you can calm down?" About 80% of the time he will calm himself down immediately, and the other 20% of the time he has a brief timeout - usually about 3 minutes. I will say that this ONLY works because every time I tell him that a behavior is going to lead to a timeout, I deliver. And the first few times (when he was 18 months - 2 years) he would sometimes continue throwing a tantrum in his room for quite a long time before calming down - sometimes 20 or even 30 minutes - but I kept explaining to him that he could come out as soon as he was calm, and eventually he got it).
Once he's calmed down, I explain to him the reason for what's happening, and what the future consequence will be if he continues to react with a tantrum - "A movie is a special treat, and we watch movies to have a good time and make us happy. When the movie is done, it's time to turn it off, and the appropriate response would be, 'thank you mama for watching a movie with me, that was really fun.' If watching a movie means you're going to be upset afterwards, then we won't be watching movies anymore, because the whole point is to make us happy." For a given situation, I typically need to offer this kind of explanation on maybe 2 separate occasions before he stops having tantrums about that thing. At this point, the worst I get in most situations is, "Why can't I have that toy, mama?" And then I say "You tell me why," and he says (for this particular situation) "because I already have a lot of toys at home, and we're only here to buy food." He will be 3.5 the end of this month.
For the second type of tantrum, there's some vulnerability involved in the way he's feeling, so he needs more compassion and understanding. If he is willing to accept a hug, then I know he's truly feeling sad about it, and not acting out to get what he wants. If this is the situation, I tell him I understand how he's feeling, and that I makes sense to feel sad or disappointed when you think something is going to happen and then it doesn't. He usually calms down very quickly with just that, but then we do the explanation thing afterwards just like with type 1 tantrums - "grandma and grampa can't come over today, even though they said they were going to, because their dog got sick and they have to take him to the doctor; I understand why you thought we would have mac n cheese for dinner since we just bought some at the store, but mama got that for lunch tomorrow, and for dinner we're having (insert food here)." Once he understands, he's usually immediately accepting of the situation and moves on. Just like with a type 1 tantrum though, if he's mad and won't listen or accept comfort, then we first start with a timeout until he's calm enough to talk about it.
The third type of tantrum is all about feeling vulnerable, and my response is all about comfort. Lots of hugs and kisses, and only understanding. I do tell him that he needs sleep/rest, and that I'll help him be in a situation where he can take a nap as soon as possible, and if it really is an exhaustion tantrum, he's grateful to hear that. I will also mostly cater to his desires in this kind of situation, because I know the root cause is feeling vulnerable, and uncomfortable, and out of control, and his "demands" are his assessment of what will make him feel safe, and comfortable, and in control (of himself and his physical space). Once he is comfortable, he will usually calm down and go to sleep, and a couple of hours later he's back to his happy self.
He has about one tantrum every two weeks, and in the last year or so has only had 2 that lasted longer than 3 minutes. Most are of the exhaustion variety.