This is a very important question and I’m glad you asked it. I’m a scientist in a field that uses a lot of animals in research (behavioral neuroscience). I personally have used both flies and rats in my research, although now I collect data from human participants.
I am also a strict vegetarian for the sole reason that I think animal suffering is fundamentally no different from human suffering. I believe there is a difference in degree, but not in kind.
To me, the ethics of animal research are determined by balancing the cost of the animal’s suffering/life against the benefit of the knowledge we gain from doing research. Sometimes the benefits are more apparent than others, and usually benefits come in incremental changes.
For instance, the research I do on people began as research on rats. That work uncovered some basic mechanisms of emotional memory, which in and of itself may not be interesting—but it has contributed to research that’s going on in my lab right now on Alzheimer’s disease, post-traumatic stress disorder, and autism. Sometimes it’s necessary to uncover some very basic information (mechanisms of emotional memory) before we can translate it into something that’s clearly useful to us (understanding Alzheimer’s, PTSD, and autism).
For the most part, this research is very tightly controlled. Every research facility I have ever known of is subject to regulation by an Institutional Animal Care and Use Committee. These committees exist to ensure that animal research is done ethically. They aim to Reduce the number of animals used, Refine methods to minimize suffering, and Replace animals with other models whenever possible.
Animal research is expensive, tedious, and unpleasant. I really think no one would do it if a viable alternative existed. Until then, I believe it is justified as long as it’s done humanely and with a clear benefit in sight.