What happens when you mix different blood types that are not compatible?
For example, if a patient has type A blood and receives type B blood, or v.v.?
The blood type of people is determined by proteins which are anchored into the surface of the red blood cells. Cells can either express the A, B, A and B or no marker, resulting in the blood groups A, B, AB and 0. People which have a certain blood type (for example A) have antibodies against the other blood type (in this case B).
This will lead to the attachment of antibodies against the subtype which you don't have (so B for people with A and vice versa) on the transfused blood cells and their lysis. Depending on the amount of blood transfused, this can also lead to a very serious immune reaction. This works like in the figure below (from here):
To avoid this reaction a sample of the blood, which is about to be transfused is mixed with blood from the patient before the transfusion takes place. This looks like this:
For more information look here:
What determines blood types is the type of antigens found on the surface of the blood. A blood cells have A antigens on their surface, B has B antigens, AB has both, and O has no antigens. What is an antigen?
According to Wikipedia:
an antigen (Ag), or antibody generator, is any substance which provokes an adaptive immune response. An antigen is a molecule that also induces an immune response in the body.
Now, not only is the blood important here but also the plasma. The plasma contains antibodies. Antibodies are (according to wikipedia)
a large Y-shape protein produced by plasma cells that is used by the immune system to identify and neutralize foreign objects such as bacteria and viruses. The antibody recognizes a unique part of the foreign target, called an antigen.
Members of the A group have B antibodies in their plasma, members of the B group have A antibodies in their plasma, AB has neither, and O has both.
Now taking this all into account and to answer your question, if B blood is given to a patient of type A, the antigens on the surface of the A blood cells would react as if the incoming B blood cells are foreign, harmful substances. To from the book "Blood Groups and Red Cell Antigens"1,
If incompatible blood is given in a transfusion, the donor cells are treated as if they were foreign invaders, and the patient's immune system attacks them accordingly. Not only is the blood transfusion rendered useless, but a potentially massive activation of the immune system and clotting system can cause shock, kidney failure, circulatory collapse, and death.”
The same would result if A blood is given to a B blood type patient, the B blood cells would initiate an immune response to the A blood cells.
To further expand on your question, this is why O is the universal donor. There are no antigens on its surface that will illicit an immune response from other blood groups. It also has both A and B antibodies in its plasma. Similarly, AB is the universal recipient. It has both antigens on its surface meaning that neither A nor B antigens will illicit an immune response from other blood groups.