Thought experiments, in the most general terms, are imaginary situations to which certain theories or methods of analysis are applied. Thought experiments are found in a variety of disciplines, and can be performed for many reasons. In physics, for example, they are used primarily because some experiments cannot be performed by actual, less than perfect, lab equipment, but the results of the theory in such situations is still important when it comes to evaluating and understanding the theory, hence the thought experiment. In philosophy the thought experiment is put to other uses, not all of them legitimate.
One use of the thought experiment is simply as a device to get readers thinking about certain problems, and to make them more receptive to questioning what they consider the best theories about the matter. As such a thought experiment cannot demonstrate anything; instead it serves as a psychological tool to motivate an unbiased (or at least less biased) evaluation of the proposal at hand. For example, suppose someone thinks that being good simply involves having the right character. If we present an alternate theory of what being good is they are unlikely to consider it seriously, regardless if it is a superior theory about goodness or not; given that they accept a different theory about what being good is they will be unlikely to be influenced by whatever we bring out in support of it, because they will just assume that their current understanding is better supported. To counteract that tendency we first present thought experiments, in which we demonstrate that even people who have the right character can, in certain circumstances, appear quite immoral. Obviously this doesn’t discount that theory as the best theory about what it is to be a good person, but it makes anyone who subscribes to that theory a bit uncomfortable with it, and motivates them to start looking for theory that better fits with their preconceptions about what it is to be a good person. And then our alternate theory is presented, and hopefully meets with a fairer evaluation, given that the reader is in a more receptive mood to alternate theories.
This makes thought experiments somewhat limited, sometimes thought experiments are treated as being able to do something more. Some view a thought experiment, which illustrates that a theory has deeply unintuitive implications in some cases, as refuting the theory. Obviously to embrace this view of thought experiments is also to embrace the idea that our intuitions are the final arbiters of philosophical correctness. Which in turn implies that we could just consult our intuitions and skip doing philosophy altogether, and thus the position is self-defeating (since the intuition of most philosophers is that philosophy has a role to play). But there is a kernel of truth in this extreme view; a thought experiment, which demonstrates that a theory is deeply intuitive in some situations, reveals that either the theory is wrong or our intuitions are off in these situations. And sometimes that is a valuable lesson. For example, Searle’s Chinese room thought experiment reveals that our intuitions about consciousness are terrible when we know what is going on at a lower, non-conscious, level (intuitively conscious and unconscious are exclusive concepts, so when we can understand a system in terms of unconscious parts it becomes hard to see it as conscious as well). That faulty intuition is behind a good deal of dualist reasoning as well, and so by recognizing it as faulty we can prune a good deal of dead-end dualist theories about the mind.
Of course so far I have been considering thought experiments that center on demonstrating that a theory is unintuitive. There are also thought experiments that serve to illustrate how a theory can be inconsistent, either with itself or with other theories. Such thought experiments have about the same role as a logical reductio, if two theories conflict then it shows that one of them must be rejected, or, if the theory is internally inconsistent, shows that the theory needs revision before it can be evaluated on its own merits. Obviously we don’t need such thought experiments in the strictest sense, if we wanted to we could derive the contradiction without going into specifics. But often the thought experiment is the better route. The thought experiment is usually easier and faster to understand, and the exact nature of the problem is, in most cases, more obvious. And so often the thought experiment makes resolving the problem more straightforward, and provides an obvious test case to see whether we have really dealt with it.
Finally, and most importantly, thought experiments can serve as motivation to develop new theories, by illustrating situations (or questions) that no existing theory is able to handle. Often this is done by creating situations including factors that seem important, but which no existing theory accounts for, or situations in which no theory seems able to guide us. This leaves room for a new theory to either explain why those factors really don’t matter and guide us properly, or to expand the existing theory to deal with the situation. Again, this is not a case where the thought experiment is definitely showing us something; it is not definitely showing us that our existing theories are lacking in any way. Rather it is a source of inspiration that motivates us to try something new philosophically. In my own work the ark problem is an example of such a thought experiment.
As presented then thought experiments perform basically a secondary role in philosophy. The core of philosophy consists of the philosophical theories themselves and the objective methods we use to analyze them. If we were perfect machines for doing philosophy that would, perhaps, be all that we need. But philosophers are, alas, still human. And so thought experiments play a valuable role in motivating us to think up new theories and to critically evaluate the theories we are biased towards. And, most importantly, philosophy is much more entertaining when we include the occasional thought provoking situation along with dry theory.