At some point in their career, every entomologist will be asked the question "do insects feel pain?" A surprising amount of research has gone into answering that question or, in some instances, unrelated research has provided insight into that query. My answer to that question has more to do with the person asking it, and as far as I know, that is a unique response.
As one who interacts with the public more than many entomologists, it has become evident that while some people have no qualms about ending the life of an insect, even advocating extremely inhumane techniques ("Kill it with fire!" is a common reply to someone else's social media request to identify a household insect), there is an increasing tolerance for insects, even in the home. If the creature is unwelcome, there is now often a plea for a non-lethal means of dealing with the uninvited arthropod.
The flipside of this more empathetic response to "bugs" is the question of whether insects feel pain. The obvious, hoped-for answer is "no, they don't." The person asking is then relieved of guilt for harming or killing any insect in the past, present, and future. So, while the new trend is for more people, especially women, to seek humane methods of insect control, many people still look for examples of how insects do not deserve empathy and compassion as a way to vindicate their own behavior towards other organisms.
The bottom line in the question of whether insects feel pain is thus the unspoken question of whether killing insects and spiders falls into the category of cruelty to animals. Legally, it would be difficult to argue that insects, being animals, are exempt from that crime. Obviously, this is not the case, and I do not see that implied public consensus changing anytime soon. Swatting a mosquito could be an act of "self-defense," though, considering the atrocious diseases that those biting flies can transmit.
Ok, so you want a scientific answer? Most entomologists I know resort to the short answer that insects do not have "pain receptors" like higher animals. This means they have no nerve cells devoted to the perception of pain. Insects can sense heat and cold, for example, and various chemical and tactile stimuli, but not pain as we would define it.
The fact that many insects, and other arthropods, willingly sacrifice limbs and other body parts in order to survive predator attacks is a testament to how apparently immune to pain they can be. A missing leg hardly slows down a grasshopper. Tattered wings rarely encumber a butterfly finishing its mission of mating and procreation.
As a colleague and fellow blogger noted in his own treatment of this question, another important aspect of physical pain is the emotional distress that comes with it. Ascribing human emotions to non-human organisms is known in the scientific community as "anthropomorphism," and is considered a big no-no when attempting to conduct unbiased research and observations. So ingrained is the concept of avoiding anthropomorphism that we now have to question whether the unemotional conclusions we draw in animal behavior studies are really the correct ones. The truth probably lies somewhere in the middle.
The fact that people are asking questions like this that leave open the possibility that insects and other arthropods are sentient beings is a hopeful sign, regardless if that belief is based in reality. We could certainly stand a little more empathy for other living things. Then again, look how we treat other members of our own species.
Source: Ballenger, Joe, 2016. "Do insects feel pain?," Ask an Entomologist.