Is the law of conservation of energy broken by the side-effects of heating and cooling a liquid that evaporates and condenses? Let's say there's a puddle of water on the ground. I use a magical device to give it enough thermal energy to vaporize into water vapor. The water vapor floats up into the sky. I then use the magical device to absorb the same amount of thermal energy I previously gave it. The water vapor then condenses to water and falls back on the ground and forms the same puddle of water on the ground.
My device absorbed and gave the same amount of energy, therefore the net energy in the system should be the same. However, it seems like the system's energy should increase from the water vapor floating up into the sky and producing thermal energy from friction with the air molecules. It should also produce more energy from friction with the air when it falls as rain drops towards the Earth and also when it hits the ground and disperses more thermal energy from its kinetic energy.
This breaks the law of conservation of energy, but I don't see what's wrong with my model. I thought about this when I read that the rain produces a lot of thermal energy from friction with the air.
 A: The reason why energy appears not to be conserved is that your scenario is utterly unrealistic.
When you say there is a puddle, what you mean is that there is a localised concentration of something like a billion billion billion water molecules each with such a low kinetic energy (on average) that they remain held together by intermolecular forces.
When you vaporise the puddle, you add kinetic energy to all of the molecules so that they are no longer tied to each other. As a result, they individually move off in random directions and at random speeds, and then undergo random interactions with the molecules that form the atmosphere. Within no time at all the molecules will be completely dispersed and none of them will have the same energy that had when they first left the puddle, having either gained or lost energy through collisions.
If, somehow, at some later instant you were able to identify all the billions of molecules that had formerly comprised the puddle, collectively they would no longer have the same energy they had collectively posessed when you first vaporised them. You say that you would now extract from these molecules the same amount of energy you initially added to them. That means you would now slow them all down by some amount. That does not mean that they would all miraculously retrace their complicated random steps and return to being a puddle, but simply that out of countless trillions of molecules in the local atmosphere, a very small proportion would reduce their average speed momentarily.
A: The first device is not so magical - you can accomplish the same result with a fire under a pot.
The second device, on the other hand, is indeed magical: you are converting heat into usable energy without any side effects. This is prohibited by the second law of thermodynamics.
You are also violating the first law, though, and the thermodynamics police are coming for you ;)
The problem lies in making an unwarranted assumption.
The vapour rises in the air, and you say you want to consider effects such as "friction", or the exchange of heat between water and other air molecules.
A proper description of this phenomenon will show that any energy gained by the air is lost by the water, so when you activate your second-law-violating device the vapour will yield less energy than what you put in initially - unless, of course, you are also able to retrieve the energy which was lost to the air.
A: You've described a scenario that adds kinetic energy to particles in the air, so there is a net increase in energy. Of course, we can regard this as "non-magical" if we admit you initially warm water (e.g. by burning oil to get the heat needed), then cool it with "the same" system (even if it's something different, we can define a system as two devices combined). Since the air warms, there is a net consumption of the machine's original energy supply. In particular, if the absorbed heat were used to reverse a process that had released some, we wouldn't quite be able to reverse it all.
A: 
I use a magical device to give it enough thermal energy to vaporize into water vapor. The water vapor floats up into the sky. I then use the magical device to absorb the same amount of thermal energy I previously gave it.

There is nothing particularly magical about these devices. An ordinary heat pump will suffice. Or you can go even simpler and just have a warm thermal reservoir at the bottom and a cool thermal reservoir at the top.
What you are missing is pressure. The enthalpy of vaporization and the enthalpy of condensation are equal (opposite) but they depend on the pressure: $$\Delta H_{vap} = \Delta U_{vap}+ p \Delta V$$
So as the vapor rises the work that you can extract is equal to the change in the $p \Delta V$ term. The $\Delta U_{vap}$ term is the same at the top and the bottom, but the $p \Delta V$ term is not.
So not as much energy gets transferred into the top reservoir. The difference is equal to whatever work you could have extracted from the cycle.
A: Let's say the water starts at temperature $T_{water}$, and you give it $E_{magic}$ joules of thermal energy, vaporising it and leaving it at $T_{vapor}$.
Then you wait a while, letting the vapor rise and interact with the air. This results in the air gaining some amount of thermal energy $E_{rise}$.
Finally you remove $E_{magic}$ energy from the vapor, which condenses back and falls back into the puddle (also producing $E_{fall}$ thermal energy in further interactions with the air and ground).
Now, your claim is that you added $E_{magic}$ to the system and then removed the same amount, so there should be no net increase in energy in the system. But also the system gained $E_{rise}$ and $E_{fall}$ thermal energy, which contradicts the reasoning that the system did not undergo any net increase in energy.
The obvious problem1 with your scenario is neglecting to keep track of the temperature of the water/vapor.
I'm assuming the water started in thermal equilibrium with its environment, so as soon as you increase its temperature above the initial $T_{water}$ it will start transferring heat to the ground and the air. This means that after waiting a while to let the vapor rise and interact with the air, it is no longer at $T_{vapor}$. Removing $E_{magic}$ energy from the vapor therefore does not return it to $T_{water}$, it must end up temperature $T_{final}$ where $T_{final} < T_{water}$.
If it is true that this whole process conserves energy, then the extra thermal energy that ends up in the air and ground must be balanced by this "energy deficit" comparing the final temperature of the water to the initial temperature.
On the other hand, if you don't remove exactly $E_{magic}$ energy from the water, but only enough to return it back to temperature $T_{water}$, you have removed some amount of energy less than the $E_{magic}$ you added, so you increased the energy in the system.

1 There are also thermodynamic problems with assuming that it's possible to add and remove thermal energy from one targeted part of a system with equal ease, and without needing to account for external energy.
A: Suppose we have water at boiling point for some pressure and temperature inside a vessel, from which mass and energy can not escape. Water in liquid and vapour state would be present, in a continuous loop of liquid -> vapour and vapour -> liquid. The energy liberated from the second phase transformation is absorbed by the first one.
All the friction and stuff like that doesn't matter because energy doesn't escape from the vessel, and will be always available as heat.
The only meaningful difference from OP scenario is the vanishing small probability that first all molecules changes from liquid to vapour state, and after that all return to liquid, keeping that process as a kind of oscillator.
The real situation is the presence of vapour and water at the same time, without macro oscillations, and just because the probability of this state is much greater.
A: Your system is larger than you have considered.
When you added energy to the water, it will immediately begin dissipating that energy through any and all means possible including convection, conduction, and radiation.
Let us consider only the radiation, and assume some of it has not been absorbed.  Those photons are leaving you at the speed of light.  Assuming you waited 1 minute between spells your system is 1 light minute in radius... far beyond the confines of the planet.
After retrieving all your stray photons, undoing all the interactions that have occurred in that minute, and otherwise retrieving all the energy originally input, you have managed to do it with 100% efficiency.  Magic indeed.
