This is an interesting question. A good example of rapid death would be decapitation. For obvious reasons, one can’t do experiments on humans to figure out if they remain conscious for any period of time after having their head chopped off. Ranging back to the time of the French revolution, the heyday of the guillotine, there are anecdotes about people who apparently remained conscious and responsive to stimuli for a few seconds after the head was severed. There are also anecdotes about people who promised to give a sign after death to indicate awareness, and failed to do so. These anecdotes are impossible to verify. Decapitation or any other human death by extreme and rapid trauma has never happened during any form of scientifically controlled conditions. All we can say based on these anecdotes is that it’s possible that some people may remain conscious and feel pain for a short while after such a violent death. It’s also possible they aren’t, and it seems likely to be so for the majority of cases.
Rats are frequently used as model animals in research, so scientists have taken some interest in the question, do rats feel pain during decapitation? Is decapitation a humane way to sacrifice animals in research? Monitoring brain activity in rats as they were killed, researchers found no brain activity normally associated with pain in rats who were awake while their head was cut off. That suggests the rats were not in pain. Other scientists have calculated that it would take no more than 2.7 seconds for the rat brain to go unconscious from lack of oxygen. Given the nature of the trauma, more intense brain activity would be expected, which would use even more oxygen, and so unconsciousness would result even quicker. Taken together, these data suggest that rats, at least, do not feel pain after decapitation, and if they did, the duration of the pain would be no more than a couple seconds.
We can’t directly extrapolate to humans, but we can speculate. It seems likely that humans, too, go unconscious more or less instantly, at least in the majority of cases. Given the anecdotes, it seems possible that some may retain some kind of awareness for an instant after trauma, but the evidence is weak, so we’ll have to call it an open question. It’s certain, however, that the brain cannot function without oxygen, and that oxygen would run out in a matter of seconds after the supply was permanently cut off, so at the most, one could hypothetically feel a few seconds of pain. But then again the rats’ brain activity didn’t suggest pain. So the best answer I can give is that most people will probably not have time to feel pain before they’re dead, and it remains an open question whether some rare exceptions may retain a few seconds of consciousness, but if so they wouldn’t necessarily be in pain for that time.