Understanding tension
Strictly speaking, tension is not the same as force, although it is sometimes described as the magnitude of the 'pulling force' experienced by an element (such as a rope).
The important thing to remember when resolving forces in classical mechanics and to understand tension is to apply Newton's three laws of motion. They are:
1st Law: an object with no external force will not change velocity
2nd Law: Force = Mass x Acceleration
3rd law: Every applied force (action) has an equal and opposite force (reaction).
So for the one dimensional cases you've given, think of the 'tension' of the rope as the magnitude of any pulling force it would be experiencing, bearing in mind that this tension is not actually a force (it has no direction), whereas the force whose magnitude it has, would be appear to be pulling the rope in opposite directions (as per Newton's 3rd law).
$T\leftarrow\rightarrow T$
So, back to your questions:
1 - When you pull on a rope tied to an immovable object, applying a force $F$, it reacts with force $-F$ (Newton's 3rd law) and the 'tension' in the rope is the magnitude of this force $F$.
$F\leftarrow\rightarrow F$
2 - If you pull on a rope which is tied a mass $M$ (initially at rest and free to move) it will accelerate towards you (Newton's second law). If you keep keep pulling the rope, keeping it taut by applying a constant force $F$ for a time $t$ and then remove the force thereby slackening the rope (no tension), the final velocity of the mass will be $v=at$ (neglecting friction). You can determine the force applied by $F=Mv/t$.
3 - If you apply a force of $X$ Newtons pulling a rope tied to a mass $M$ which I am holding, the tension on the rope is $X$ as long as the mass isn't moving. If I increase my pulling force to $Y$, the resultant force, $F=Y-X$ will pull you along with the mass, towards me. Note that we subtract the forces because they are acting in opposite directions. The resultant force $F$ will accelerate both you and the mass towards me at a rate $a=F/(M+m)$, where $m$ is your mass (assuming the mass of the rope is negligible). The tension on the rope will be equal to the magnitude of resultant force on the rope, which is $T =\lvert X-ma\rvert = \lvert X-m\times \frac{F}{M+m} \rvert= \lvert X-\frac{(Y-X)m}{M+m}\rvert$. Note that if your mass, $m$ is negligible, the tension of the rope becomes $X$, whereas if the mass of the body $M$ is negligible, the tension of the rope becomes $Y$. If your mass is equal to the mass of the body $(m=M)$ then the tension on the rope is $(Y-X)/2 = F/2$.
If I apply a pushing force $Y$ directly to the body of mass $M$, while you pull on the rope tied to it by applying a force $X$, the resultant force on the mass will be $F=X+Y$ (in your direction). The two forces are added not subtracted (since they are applied in the same direction towards you). The body will therefore accelerate in your direction (Newton's second law) under the total force $a=F/M$ and the tension on the rope will be equal to the magnitude of the resultant force, $(F-Y)=X$. Note in this instance, your mass is irrelevant, because the rope does not transmit my pushing force $Y$ to you (a rope does not work under compression!).
4 - If two bodies of mass $M$ are tied together with a rope and are moving in opposite directions at a speed $v$, they will each have momentum with magnitude $Mv$ but in opposite directions. Since neither mass is experiencing a force, they will continue to move at at constant velocities in opposite directions (Newton's 1st law), until the rope between them becomes taut. At that point, they will quickly decelerate and travel back towards each other. The rate of deceleration and subsequent speed at which they will travel towards each other will depend upon the 'elasticity' of the rope as well as the amount of 'friction' in the rope. In the case of an 'inextensible' rope with no friction, the rope will have a non-zero 'impulse' tension only at the instant it is taut. The two bodies will then move towards each other with the same velocity as they were previously moving away from each other (due to conservation of momentum).
Until you realise that tension is not the same as force, you may experience a little tension yourself as you grapple with the concept!
As an aside, you may come across some textbooks on engineering mechanics or materials which describe tension as a type of pressure or stress (force per unit area) as in 'tensile stress' applied to a truss member. If we define the area as a vector whose magnitude is the cross sectional area of the material under stress and whose direction is normal (perpendicular) to the cross sectional area, then the resulting force is the product of stress and area. In the most general sense, since the tension may have a different effect in different directions (anisotropic), the resulting force is not necessarily in the same direction as the area. In a three-dimensional Euclidean space, the tension is a tensor of rank 2. This is a linear transformation (mapping) with $3^{2}$ co-ordinates, something like a (3x3) matrix, which when 'multiplied' by the "area vector" produces the resultant "force vector" (not necessarily in the same direction).
However, since your examples are all dealing with forces in 1 dimension only, we can treat tension as a scalar (that is, a tensor of rank 0) whose magnitude is that of the force exerted by the rope under tension.