What is the difference between the contact force and Tension? Both are electromagnetic forces, yet why does tension pull whereas the contact force pushes?
It is not like a rope has some material which can pull, if a slack rope is just kept on a table then it exerts a contact force on the table.
 A: Both the contact force and tension are just simplifying constructs that we use to understand and work with classical mechanics on a macroscopic, low-resolution level. What they represent on the molecular level are a huge number of individual electromagnetic interactions, some attractive and some repulsive, that give objects their macroscopic properties. In other words, it's going to be complicated linking the two, so bear with me for a while.
First, let's examine the contact force. Typically, this involves one rigid object being pushed externally against another object. Both objects are constructed of a lattice of atoms bound together with attractive electromagnetic forces that generally keep their spacing when forces are applied.* At the boundary between the two objects, the electron clouds from one lattice repel against the electron clouds from the other lattice, exerting the same external force against the second object. Since there are no attractive interactions between the two lattices,** pulling one object away does not cause any force to be transferred.
Now, let's look at tension. In this case, the situation is a bit different: now we have one object attached to another object, which means, microscopically, that their lattices are in some way joined together into one large lattice, that again, wants to keep its spacing intact when forces are applied.* Now, when one end of one object is pulled, to keep the lattice from being pulled apart, the atoms further into the object exert an equal attractive electromagnetic force, which makes atoms even further in respond with an equal attraction, and so on, transferring the force through one material, through the boundary between the materials (which are now joined together into one lattice), and to the end of the second material. Since the lattice doesn't want to be deformed, the net effect is that the second material is pulled along with the first.***
But this doesn't really answer the question of why a rope can't be used for pushing. The answer to that question lies in a property of the lattice itself: rigidity. A rigid object has a strongly bonded lattice that resists shear deformation (i.e. bending), whereas a less-rigid (flaccid?) object has a lattice that admits shear deformation. Typically the miroscopic picture for the former case is a 3-D structure with a high degree of symmetry,***** like a crystal, whereas in the latter case, the lattice may take the form of long strands with strong internal bonds that are only weakly bonded to other strands. Oftentimes it is less costly, from an internal energy standpoint, to allow the strands to slide past each other than it is to keep them together, resist deformation, and transfer a pushing force.**** A rope is the poster boy of a flaccid object, and as such it does not admit much pushing before it simply bends away.
You are correct in that a rope lying on its side on a table exerts a contact force. But this is quite different than a rope being lowered from its end onto a table. In the former case, the strands in the rope are being pushed together from the side; though strands are only weakly attracted to each other, they repel strongly when brought close enough together, so a contact force is possible. In the latter case, the strands are being pushed from their ends, which allows the strands to slide past each other and mitigate much of the repulsion from the table.
On a related note, a rigid object glued to another rigid object can exert both contact force and tension, for the reasons outlined above. As I said before, though, this description is quite complicated, and I provide above only a surface-level (i.e. not-entirely-correct-in-some-situations) description of the events in question. See the footnotes below for some higher-order effects.
*This is assuming that the materials in question are incompressible; in reality, the lattice spacing does change a bit along the direction the force is applied, which is the source of the eletromagnetic repulsion.
**In reality, there is a weak attractive force between neighboring lattices because each lattice induces, via electrical repulsion, an opposing electric dipole in the other lattice; these dipoles attract, giving rise to the Van der Waals interaction. Sometimes, as in the case of two extremely clean, smooth surfaces of the same material, this attraction is actually enough to fuse the two lattices together! This is called optical contact bonding.
***This only holds true up to a certain point; with enough force, you actually can pull apart some point in the combined lattice, at which point you no longer have two objects that are attached anymore.
****You may have noticed that with a low enough force, a rope actually can push something a little bit if you hold it perfectly straight, and it's only when you increase the force that the rope buckles and ceases to push. This is (to a very simplified degree) because the force you exerted was smaller than the bonding force holding the strands together. But the phenomenon of buckling is far more complicated than that, and I will admit I'm not qualified to talk about it here.
*****This is not always the case. For example, materials like glass have a random arrangement of atoms in a lattice, and biological materials like wood exhibit a high degree of non-trivial order that doesn't fit this pattern. But crystals are relatively common and serve as easy-to-explain examples of rigid objects, so I use them in the main text.
