What is wrong with this quantum perpetual motion scenario? I'm wondering about this. One of the things I notice is that the "orbitals" -- wave functions, really, probability distributions for the position of electrons stuck on an atom -- don't actually end. For example, for the 1s orbital of hydrogen, we have
$$\psi(r) \propto e^{-\frac{r}{a_0}},\ r \ge 0$$
where $a_0$ is the Bohr radius. This is never zero, no matter what $r$ is. So in a sense the atom doesn't truly come to an end, and where we put the "boundary" of the atom is somewhat of an arbitrary construct, e.g. we could use a "95% probability" sphere thereabout.
Of course, given the exponential term that means the probability falls off extremely fast -- e.g. at 10 Bohr radii the above is about 1/20,000 and while this is not itself a probability as the above is just a density so we should really integrate it, it's a fair order of magnitude estimate. So in theory, the above means there is a probability to find it at even very remote distance, so far we may practically consider the atom ionized, right? E.g. at a distance of six meters, with $a_0 \approx 53$ pm, the probability would be roughly on the order of 1 chance in $10^{50,000,000,000}$, where the exponent is itself an estimate so we are using the term "roughly" extremely generously. But that is not zero, so in theory I could be that lucky.
So suppose we have this scenario. We're at the lab and we've got the atom, and we measure the electron. The luck gods were really smiling that day. Before we went to the lab we saw in the early morning twilight a pair of two headed calves circumambulating the house out the window. They make six full cycles around and then left, and then on taking the bus to the lab, we saw a tire on a car nearby do this:
https://www.youtube.com/watch?v=u1PyKd3ETDw
AND I knocked over a coffee mug and the water spelled out "Snookered!," all on the time leading up to the experiment. :) Finally, at the lab, when measuring the electron it was found to be six meters away, and was captured right there. So this would mean the state has shifted to one with the electron now not attached to the atom, right? The captured electron is then returned to the atom. So it then releases 13.6 eV, right? Which we could then capture with, say, a photovoltaic and get in a battery. But where did this energy come from? Does this mean that conservation of energy was violated for real, and not just as a quantum fluctuation? Does this mean perpetual motion machines could be possible with quantum mechanics, even if they are extreeeemely infeasible in that they depend on literally incomprehensible luck?
(But more seriously, it seems we don't necessarily need such preternatural luck for there to be a problem: even at a distance of, say, 10 Bohr radii which is plausible with the given order of magnitude for the probability, shouldn't it be possible to "drop" the electron down again and get some "free" energy?)
 A: The electron in a hydrogen atom does not have a position because it is delocalised over the whole orbital. That doesn't mean the electron zips around and on average is spread out over the orbital, it means the electron simply doesn't have a position in the sense that positions of particles exist in classical mechanics.
The probability:
$$ P(\mathbf r) = \psi^*(\mathbf r)\psi(\mathbf r)dV $$
does not give the probability that the electron is in the volume element $dV$ located at the position $\mathbf r$, it gives the probability that anything interacting with the hydrogen atom will find the electron in that volume element.
But any interaction with the hydrogen atom takes some energy. We know this is the case because after the interaction the wavefunction is localised so it is different from the wavefunction before the interaction, and as a result the energy of the electron will have changed. That energy comes from whatever process is responsible for the interaction.
So if your Magical Electron Detector™ detects the electron a large distance from the proton that means it must have consumed at least 13.6eV of energy to make the detection. Letting the electron fall back onto the proton and capturing the 13.6eV released would at best get you back to where you started.
A: Here's the thing:


*

*You can be arbitrarily far from the nucleus and still be bound to the ion. 

*You can also be arbitrarily close to the nucleus and still have enough kinetic energy to be ionized. 


In your scheme, the atom does get ionized, but the distance at which the electron gets detected plays an insignificant role. 
Instead, what really matters is the precision with which you determine the position: because of the Heisenberg Uncertainty Principle, having a small position uncertainty means having a large momentum spread, and this requires a large average kinetic energy. If this kinetic energy is large enough, no matter where the electron is, it will likely be ionized. 
This also tells you where the energy is coming from: even with a free electron, localising the position requires an increase in the average kinetic energy, and this added energy needs to be provided by the interaction with the measurement apparatus. 
The first law of thermodynamics does need to be handled with care in single-shot quantum mechanics, where quantum fluctuations can create apparent nonconservation situations, but here even those parts don't get to play a role. 
