Why a force is needed to pull an object away from water? If a pin or any object is floating in water a force is needed to pull the pin away from the water in addition to gravity. My problem is that surface tension is something which makes the object float rather than attracting it. So why should it result in a force that resists the object being pulled away from water? 
 A: Surface tension means that it costs energy to increase the surface area of the liquid. The energy changes by $\Delta E = \sigma \Delta A$ for a small change $\Delta A$ in the surface area and $\sigma$ is the surface tension of the liquid.
This equation explains both why surface tension can let objects float and why surface tension implies there is a force when we pull the object away from the liquid. The additional ingredient is that the water-air contact line "sticks" to the object and, depending on the material and the object's surface texture, prefers to form a certain angle to the object's surface.
When we pull the object away from the water we deform the water and at some point we will increase its surface area, which requires us to perform work as per the equation and this means we must exert a force along some length to provide this energy. It will be directed downwards since the surface area increases as we pull the object out.
Similarly, if an object rests on the water surface, carried by the surface tension, the water sticks to the sides of the object, an the water surface is deformed by this due to the gravity acting on the object, again there must be a force $F = \partial_l \Delta E(l) = \sigma \partial_l \Delta A(l)$ and this time it acts upwards (since the area of the surface increases as the object is moving downwards).
A: Sebastian Riese explained that surface area constitutes a form of potential energy, and thus increasing it requires a force, but I think that the causality of that is backwards. Potential energy doesn't cause force, force causes potential energy. 
Also, I don't think that surface tension explains objects sticking to water. Surface tension is due to cohesion, while sticking is due to adhesion. To keep it simple, I'll give my analysis in two dimensions, one horizontal and one vertical. With just water, there would be a horizontal line representing its surface. Now imagine a circle, with what would be the surface of the water running through its center (it's no longer the surface of the water because the circle is there). That is, the circle is floating in water, halfway submerged. Now imagine the circle is pushed down (effect of gravity). Look at where the circle meets the water on the left. At this point, the normal vector of the circle is sloping up to the left. So if there's an attractive force between the circle and the water, the force will be directed up and the left. Similarly, if you look at the right side of the circle, there will be a force up and to the right. The left and right components of these forces will cancel out, and the net force will be to pull the circle up.
If you imagine trying to pull the circle out of the water, then once the circle is more than halfway out, this analysis will reverse, and there will be a downward force on the circle. 
It turns out that the force is always in the direction that decreases the surface area of the water; there's a mathematical proof of that, but I won't go any further into it than I already have. The minimum surface area occurs when the circle is halfway submerged, so if you push down, the adhesive force will push it up, and if you pull it up, the adhesive force will pull it down. But this "decrease surface area" tendency is a higher-level phenomenon that emerges from the adhesive force, not the cause of the adhesive force.
Surface tension comes from the force between water molecules being lower than the force between them and air. If the force between water molecules and metal is smaller than the force between water molecules, but larger than the force between water molecules and air, then you will still have surface tension, but you can still have a net attraction between the pin and the water once you raise it far enough.
