How do electrons know when a circuit is closed? I was told that electrons do not begin flowing unless the circuit is closed. The electrons from the battery are not in the ends of wire when it is open, apparently, as there is no reason for them to go there. They do not "test the waters", so to speak. So how do they "know" when the circuit is closed? 
Also, when do they know? Do they know the instant it is closed? Please resolve this vexing problem for me.
 A: As long as you provide a power source to a circuit, whether it is closed or not, electrons will definitely begin to move to a small amount. There are two specific cases which I think would best demonstrate this point.
Case 1: A circuit with a capacitor.

A simple capacitor contains two electrically conducting plates separated by an insulator, which could be for example air. In real life, a capacitor could simply be two sheets of copper parallel to each other, but not touching. An analysis of a circuit containing a capacitor, such as the above shown RC circuit, shows however that current DOES still flow, even though the circuit is not 'closed' in the sense that you mean it. You might ask "how does current flow, if there is a gap of air between the capacitor plates?" and the answer is that the current that flows is minimal, and the charge that is moved builds up on the capacitor plates, until the voltage from the charges on the capacitor cancels out the voltage from the battery. Hence, a better explanation is to think that the electrons are always testing the water (in particular, the electric field throughout the circuit).
Case 2: A really big circuit
 
Ultimately, the reason that electrons travel through the wire in the first place is because of the electric field that exists throughout space. In the case of a really big circuit, if you imagine that initially the circuit is closed and there is a constant current flowing and I get a pair of scissors and cut a part of the wire, 99% of the other electrons just won't care that the circuit is now open. From the electron's point of view, the world looks just like it did before the cut, the power source is still there, the loop of wire is still there, the only difference being a single break in the circuit, which does nothing (as of yet) to affect the electric field. They'll keep on travelling about the circuit just as they did before. Eventually, however, they'll build up at one end of the cut wire, and THEN the situation will change, and the current will stop. My point is that the circuit being open doesn't inherently mean that no electrons will flow.  
A: Keep in mind that for whatever magical reason electrons repel each other (like charges), and are very attracted to protons (opposite charges). Due to the omni-directional bonding present with metals (electron sea model) electrons move freely around but the metal maintains a net charge of zero.
Try not to think of the electrons as "testing the water." I find it much easier to think of circuits from the battery's point of view. Due to the laws of chemistry the battery wants to maintain a 1:1 ratio of electrons and protons. Think of it like a tug of war. The positive end starts pulling but no work is being done, and the negative end keeps pushing put no work it done. The negative end cannot give an electron unless the positive end receives one. That is why the electrons in the wire create a net movement, even if the the electrons originally in the battery decide to never come back, for every one that "joins" the wire another one is "pushed" out. Don't forget that the battery is not picky where its electrons go or come from, just as long as it gets one back for every one it loses.
A: The electrons from the battery are not in the ends of the wires, no. The wires do contain electrons, however. Conductors  have free electrons which can "float" around in the metal.  There is an electric field between the two terminals of the battery. The electrons experience a force due to this field. When the wire is not connected, the electrons don't go anywhere because there isn't a path for them to flow around. Imagine one end of the wire being connected to the negative terminal of the battery and the other end of the wire brought very close to touching the positive terminal. The electric field is going to cause the electrons to move toward the positive terminal of the battery. Since there isn't a closed path for them to flow, the electrons are going to "bunch up" at the end of the wire close to the positive terminal. The displaced charge will produce it's own electric field that will exactly cancel the electric field from the battery, and the charges will stop building up on the end of the wire. When the battery is connected, there is a path for the electrons to flow and all the built up charge is absorbed into the battery. Since there is a closed path for the electrons to flow around the circuit, there is no way for a charge to build up that opposes the electric field of the battery. So, a current flows.
A: 
I was told that electrons do not begin flowing unless the circuit is closed.

This is true. Broadly speaking.

The electrons from the battery are not in the ends of wire when it is open,

The electrons involved in electric current are present throughout the metal wire. They are not supplied by the battery into an "empty" wire. The metal in the wire is awash with free electrons.

apparently, as there is no reason for them to go there. 

There is no need for electrons from the battery to be present at the other ends of the wire, the metal of the wire contains vast numbers of free electrons.

They do not "test the waters", so to speak. So how do they "know" when the circuit is closed?

They respond to the electric field.
Note that if the far end of the wire is unconnected, electrons do not significantly accumulate there under the influence of the electric field of the battery because, apart from anything else, a large accumulation of electrons would repel one another and prevent newer electrons joining them.
Note that in certain cases electronic engineers do have to take into account stray capacitances in wires and connectors. Beginners working with typical DC batteries and LEDs etc don't need to worry about this.
A: To answer in a more simple fashion: the electrons in the wires feel repulsion from the other electrons. When no current in moving around, they are in a state called equilibrium. Essentially, the electrons in front of and behind our electron - let's call him the "test electron" - are stationary, so he's roughly stationary too. The forces from his neighbors all balance out. Technically, thermal energy and random fluctuations around him make him jiggle around a bit, but overall he and his friends and just sort of milling around in the same area. This is the case when the circuit is open and no current can flow.
Now, we close the circuit, completing it, and perhaps attach a battery or apply a current of some sort. In the instant this is done - mere fractions of fractions of seconds - nothing happens to test electron (assuming test electron is in the middle of the circuit). The electrons around him are also basically still for this tiny, tiny fraction of a second (unnoticable to our human senses). However, a change quickly moves through the circuit. Electrons near the battery are tugged or pushed, and their electric charge then pushes and tugs their neighboring electrons, and very quickly this force is propagated and felt through the entire circuit. Note that the speed the force travels is very quick, faster than the speed of the actual electrons, but not infinite. Electromagnetic forces are propagated by light waves, which move extremely fast. 
As noted above, how much current you get is determined by Ohm's law: 
V = IR  or I = V/R
Here, I is our current, V our Voltage (presumably from the battery) and R the resistance of the circuit. 
To think of it another way, it's like pushing a car. Technically, when you lean over and push the back bumper there's a chain reaction moving from the back of the car toward the front and the whole thing lurches forward bit by bit. However, the electric forces between atoms and molecules in the car transmit very quickly (basically close to the speed of light), so we basically see the whole car move at once. 
Some people, however, take this too far and try to image building a giant rod of metal from here to another star system. They think that since they can jiggle a human sized rod and the whole thing appears to move instantaneously, that we could do the same thing to communicate between here and distant stars faster than the speed of light. However, at interstellar distances, the force that moves the atoms has to go so far (light years) that the jiggle would actually be noticeably delayed from getting from the front of the rod to the end. The force can only travel - at maximum - at the speed of light, so at several light years of distance is would take several years for the force to jiggle the end of the rod. Crazy, huh?
Hope that makes sense! 
A: The electrons in circuits moving as a incomprehensible fluid. At least for sufficiently small electric field. So, the information of boundary on the circuit are transmitted through the electrons via equilibrium. You can imagine a lot of boxes distributed over the conductor that the circuit is made up. Each box has your own chemical potential. The information of the boundary are transmitted by fast equilibriums over this boxes.
You need to understand that a lot of transient complications happens in the middle of this conversation, but they are incredibly fast and then unimportant almost all the time. In usual time scales of electronic devices we have thermodynamic equilibrium locally through the conductors.
Take this circuit:

We have an neutral plate ($0$) connected with a battery in the positive side ($+$). At a small interval of time this system is already in equilibrium:

The charge is spread over the neutral parts. We can describe the the intermediate process by differential equation if the time scale is big enough in such a way that we can assume local thermal equilibrium. The solution of the most simple differential equation is a typical exponential on the time variable. This equation relates the charge at the plate with time. This solution already give us an particular time scale $\tau$ (Relaxation Time).


*

*For times $t$ much more long than $\tau$, this equation is useless and we do not appreciate any current.

*For times $t\sim\tau$ we do appreciate current and this equation dictates your behaviour.

*For times $t$ much more short than $\tau$ this equation is no more valid and things start to be more complicated.

A: Due to the chemical potential in the battery incitating charges to migrate, one battery end somehow suck electrons, yielding some "tension" of free electrons in the wire (slight loss in electrons). 
The other end somehow push, yielding some "pression" of free electrons in the wire (slight excess in electrons).
If both ends are not connected because the circuit is open, an equilibrium is reached within the ends and nothing move.
If they are, the excess on one end, the loss on the other end, can propagate from place to place in the wire, so that the new electrons can be suck/pushed.
A: You are basically asking when current does happen. In a macroscopic level, the answer is simple:
$$
\mathbf J = \sigma\mathbf E
$$
We can have this equation applied to a circuital point of view, thus arriving at Ohm's Law:
$$
V = RI,\quad\quad I = GV.
$$
The value $R$ is known as resistance, and $G$ is known as conductance.
When there is not current? Simple. When $G = 0$ or $R = \infty$. Why? Apply the law: $I = GV$. If $G=0$ then $I = 0$. So, no current if conductance is zero. Also, the higher the conductance, the higher the current, for a same potential difference $V$. Resistance and conductance are related: $V = 1/G$.
Since in real world there is no material with zero conductivity, there is always current. If conductance is too low, the current is too low as well, that can be ignored. In other words, the resistance is too high, toooo high, to have a considerable minimal current $I$.
However, when you close the circuit, you now have a high conductive path across the potential difference. Now, there will be considerable currents due to high $G$, or due to low $R$.
A: I could be wrong, but there is a phenomenon in physics called quantum superposition. To briefly explain it, an electron can be in all possible allowed places at once until it interacts with another particle causing, in laymen's terms, the universe to "observe" it. When a circuit is closed, the free electrons are given a specific path in which they may go, therefore they seemingly materialize and buzz through the circuit. Look at explanations of the famous "double slit experiment," quantum superposition, and wave-particle duality. These will provide much more info than I can squeeze into this paragraph.
