How do we know that Mycobacterium tuberculosis actually causes tuberculosis? More generally, how do you prove that a given organism is the cause of a given disease? Robert Koch was the first to demonstrate such a connection, and set forth the logical foundations required in 1882 in his lecture Über die Aetiologie der Tuberkulose. I highly recommend reading the original (available here in English; I don't have a link handy to the original German).
Modern expositions put forward the postulates in a didactic manner. Wikipedia's is a fair sample:
Koch begins, "It was first necessary to determine if characteristic elements occurred in the diseased parts of the body, which do not belong to the constituents of the body, and which have not arisen from body constituents...and if they show any of the characteristics of independent organisms, such as motility, growth, reproduction, and fructification." The example he gives is from anthrax: "If the blood of an animal dying of anthrax is examined, one finds in it a large number of regular, rod-shaped, colorless, immotile structures."
Koch does not state the second part of the postulate as it appears above. Tuberculosis can lie dormant in the lungs of a host for decades without causing illness. It was Koch who isolated the causative agent, Mycobacterium tuberculosis. He knew he could not insist upon such a condition.
There are other causes which can make such a requirement fail. A host may be infectious, but not ill. Typhoid Mary is the classic example of this. A given species may also not be universally disease causing. Vibrio cholerae, the bacterium which causes cholera, is generally a benign organism that lives in the water or quietly in aquatic animals. There are certain genes which it can acquire, however, which turn it into a scourge. Thus you are likely to find Vibrio cholera in many individuals, but in a form which is totally incapable of causing disease.
The next three correspond to an experimental technique. We have found some creature in the tissues of infected individuals, but how do we demonstrate that it is the causative agent? Koch's answer is to separate "the parasite from the diseased organism, and from all of the products of the disease which could be subscribed to a disease-inducing influence, and then introducing the isolated parasite into healthy organisms and induce the disease anew with all its characteristic symptoms and properties."
Koch's anthrax example is particularly clear. Anthrax will grow quite happily outside of a host if it is provided with nutrients, but the blood cells of the host do not, and all the chemical makeup of the blood besides cells don't reproduce. If we take some blood from an infected animal, and spread it over a nutrient rich medium - a slice of potato, say, boiled to make it sterile - then the anthrax bacteria will grow, and the other components will not. If some of the resulting bacteria are spread on a new potato, and this is repeated again and again, then eventually the blood of the animal becomes negligible.
What if there are other bacteria which come along as well? The easiest way to rule this out is to examine what is growing on the potato under a microscope. If all you see are the "rod shaped...structures," then you have some confidence that there are no other bacteria. Further, if you spread the bacteria very thinly on the new potato, you can get their density low enough where you get colonies that arise from only a few cells. If you have a second bacterial species, then you should get some colonies with only one and some with only the other as well as the mixed ones. If all your colonies still produce the same disease in another animal, then you can have some confidence that there is no other bacterium.
But what about a virus? With modern tools, you might separate the bacteria from any viruses by centrifuging them. The bacteria will settle at the bottom of the tube long before any viruses will. Then you can proceed with both separately. There may even be cases where you have to have both bacterium and virus in order to get the disease.
There are bacteria that won't grow outside of a host. Mycobacterium leprae, a relative of tuberculosis, and the causative organism of leprosy is the classic example. It is cultured in the lab in the footpads of armadillos, as it has lost many of the genes it would need to grow outside of a host. How do you show this connection? Gerhard Hansen, the Norwegian physician who first found the bacterium, had trouble convincing others of his findings for this very reason.
Viruses cause similar problems. A virus cannot reproduce without a host. Generally viruses are maintained in the lab by letting them prey on cultures of cancer cells, but this makes the isolation much more difficult. However, in the century since Koch, our knowledge of the makeup of mammalian cells has grown enormously. Today a biochemist can with some confidence remove everything from such a culture of viruses and cancer cells except the virus.
There is one great weakness to this logical structure: you must have an animal model for the disease, a cheap one which lets you infect many individuals. Anthrax will happily infect most mammals. Tuberculosis is perfectly capable of killing mice, guinea pigs, and rabbits as well as humans. But HIV will cause AIDS only humans and, with difficulty, chimpanzees. How do you demonstrate that the virus is the cause then?
HIV has two animal models: mice, in which the virus does not cause AIDS, and chimpanzees, which can only be infected by the less virulent of the two major strains, and which are simply impractical for large studies. It can infect cells in tissue culture, but many times these cells are disrupted by the culturing process, and even if they are not, the larger physiology is lost.
Actually, HIV has fulfilled Koch's postulates: laboratory workers who have accidentally been infected with various virus cultures develop precisely the same disease as normal transmission (see here. But this is not data you can intentionally collect. That was firmly established by the Nuremberg Code and the aftermath of the Tuskagee experiment.
Animal models go further afield. Some groups are studying broad spectrum pathogens in C. elegans, a tiny worm. Others are studying the same pathogens is systems closer to humans. What if the mouse model disagrees with the C. elegans model? There is no general solution to how to select what is relevant from a given animal model. For instance, tuberculosis in mice causes macrophages to release strong bursts of nitric oxide. Some investigators find that human macrophages infected in a culture dish don't release these same bursts. Is this an important difference or an artifact of culturing?
But what if there is truly no animal model available? Generally we fall back on a phantom "fifth postulate": treat the disease in patients as if it were caused by the proposed organism. If the treatment works, then perhaps you have found the right organism.
This is medically sound, but scientifically inconclusive. Consider a bacterium which has become symbiotic with a virus. It carries the virus's genome in its own, and when it infects a host, expresses that genome to create virus particles which it secretes into the host. These virus particles infect and destroy cells of the immune system which would control the bacterium.
When you study the disease, you see the immune system being destroyed, and search for what is doing it. You find the virus, and devise retrovirals against it. When you treat the patient, it controls the disease. The fifth postulate would say that the virus was the etiological agent of the disease.
The fifth postulate can be used to disprove connections, however. The bacteria and virus symbiosis I describe above bears a vague resemblance to one disproved idea about HIV, but we can show that HIV is not like this: an AIDS patient will recieve large quantities of antibiotics to fight off other diseases. Tuberculosis alone, one of the major killers, requires administration of four powerful antibiotics at once. In short, HIV and any possible symbiont are exposed to every class of antibiotics known. Any bacterial symbiont should have been handily slaughtered by at least a subset of these.
But why can't this show that HIV is the cause? What if there were another virus affected by the same retrovirals that we for some reason just weren't noticing? There is no way to control for this short of isolating the HIV virus and showing that it, and it alone, is sufficient to cause disease --- in short Koch's program.
These same difficulties show up more strongly in what are termed microbiota shift diseases, diseases resulting from a change in the composition of the body's native microbes. The standard example is bacterial vaginosis. There is an incredibly strong correlation between a certain shift in the bacterial population of the human vagina (from mostly Gram positive species to mostly Gram negative species) and possible minor symptoms like vaginal discharge and a bad odor, and premature births. If you treat with antibiotics that target Gram negative bacteria, you can restore the original balance, and remove the symptoms. But how do you even go about defining "etiological agent" in a complex of many species?