Many organisms residing in our body and have a symbiotic mutualistic relationship with our body e.g. organisms in our small intestines. How come our body does not activate an immune response against them? Is it that the organisms have self antigens, or do the immune cells have no antibodies for these organisms? Also, how come our immune system is able to respond to these same organisms if they cause an infection in our body? E.g. Entamoeba histolytica causing amoebic dysentery.
Molecular context is important here. E.coli in your colon is OK with the body, it is taken up by phagocytes as part of normal "surveillance". Your immune system will learn and gain "tolerence" to these mutualistic bacteria as long as they are in the correct environment.
If that same E.coli is a pathogenic strain or finds a way into the blood stream (sepsis), your body will recognize that it does not belong and mount a immune response. There are different classes of antibodies with different properties including where they are predominantly found. For instance IgE is found in mucosa but not in serum.
On top of that there are the 'Danger/Pathogen associated molecular patterns' (DAMPs or PAMPs). Cells can 'sense' general molecular patterns such as LPS, unmethylated CpG DNA, double stranded RNA through a class of molecules called Toll-like receptors (TLRs). Different TLRs are found in different cells or cell surfaces and they are the 'first line' response against inappropriate bacteria or viruses.
Once the TLRs are activated the cells will produce 'Danger Signals' called cytokines which initiates an immune response. In the absence of 'Danger Signals' present in the microenvironment, our immune system won't really begin mounting an immune response but just 'surveys'.
In this 'danger' context, you get robust phagocytic response.
If you'd like to learn more about this Mucosal Immunology is what the topic is called. All in all, the vast majority of our immune system is mucosal, it's just less studied relative to humoral immunity since it's harder to study.