Mechanics around a rail tank wagon Some time ago I came across a problem which might be of interest to the physics.se, I think. The problem sounds like a homework problem, but I think it is not trivial (i am still thinking about it):
Consider a rail tank wagon filled with liquid, say water.
Suppose that at  some moment $t=0$, a nozzle is opened at left side of the tank at the bottom. The water jet from the nozzle is directed vertically down. Question:  
What is the final velocity of the rail tank wagon after emptying?  
Simplifications and assumptions:   
Rail tracks lie horizontally, there is no rolling (air) friction, the speed of the water jet from the nozzle is subject to the Torricelli's law, the horizontal cross-section of the tank is a constant, the water surface inside the tank remains horizontal.  
Data given:  
$M$ (mass of the wagon without water)
$m$ (initial mass of the water)
$S$ (horizontal cross-section of the tank)
$S\gg s$ (cross sectional area of the nozzle)
$\rho$ (density of the water)
$l$ (horizontal distance from the nozzle to the centre of the mass of the wagon with water)
$g$ (gravitational acceleration)  
My thinking at the moment is whether dimensional methods can shed light on a way to the solution. One thing is obvious: If $l=0$ then the wagon will not move at all.
 A: OK, that is my second tentative to solve this problem. I think I have a solution this time, thank to the discussion of others in that thread. The solution is $v_{\text{final}}=\sqrt{2gh(0)}\frac{ls}{h(0)S}(1-\frac{\pi}{2})$ if $m\gg M$. This corresponds to a few millimetres per second towards the left for a wagon full of water. 
Here is how I've derived it :
Notation
In order not to neglect not negligible contributions, I will pose the problem for a cart of a quite arbitrary shape, before restricting it to our cart.
We have :


*

*$S(z)$ : section of the cart at altitude $z$

*$h(t)$ : height of water at time $t$

*$l(z)$ : abscissa of the centre of mass (CoM)  of the slice of water at altitude $z$
 - $M$ : Mass of the empty cart

*$m = \int_0^h(0) dz S(z) \rho$ : initial mass of water

*$\mu(t)$ : remaining mass of water at time $t$

*$f(t)=-dµ/dt > 0$ is the mass flow of water

*$v_v(z,t) < 0$ : vertical speed of the water slice at altitude $z$ 

*$v_h(z,t)$ : horizontal speed of its CoM.


In the case of the cart, we will have :


*

*$S(z)$ is constant above the nozzle. Let $\delta+\epsilon$ be the nozzle height. We then have $S(z)=S$ for $z>\delta+\epsilon$. For numerical appplications, we'll suppose a $3\times3\times10$ m³ cart, with $S=30$ m².

*The last part of the nozzle is a pipe of height $\delta\ll h(0)$. In this pipe $S(z<\delta)= s\ll S$. If the output has a 10 cm side, $s=1O^{-2}$ m².

*$h(0) = 3$ m

*Above the nozzle, the CoM of the water is fixed at $l(z>\delta+\epsilon)=0$, while in the lower part, $l(z<\delta)=-l$, wher $l=5$ m.

*I'll assume $M=10^4$ kg, but I've no idea whether it's realistic.

*$\rho = 10^3$ kg·m⁻³

*$m=\rho S h(0) =$ 9·10⁴ kg

*$g=10 m·s⁻²$


Vertical movement of water
In the following, we will assume that the horizontal acceleration $a$ of the cart stays $a\ll g$ during the movement. A nonzero acceleration would induce correction terms proportional to $\frac{a^2}{g^2}$, and we will check that this hypothesis is consistent later. This assumption allows us to neglect any motion of the cart when looking at the movement of water in the cart referential, and then compute $f(t)$, $h(t)$ and $\mu(t)$. We will then use the resulting f this computation to find the horizontal movement of the cart.
The incompressibility of water allows us to write
$$ f(t)=-\rho S(z,t) v_v(z,t) =\rho S(h(t)) \frac{dh}{dt} =- \rho s v_v(0,t)  \quad(*)$$
Bernoulli, at altitude $h$ and $0$ gives us
\begin{gather}
\left(\frac{dh}{dt}\right)^2 +  2gh = (v_v(0,t))^2 \\ 
2gh=(dh/dt)² (\frac{S(h)²}{S(0)}² -1)
\end{gather}
In our case, except in the nozzle, $\frac{S(h)^2}{S(0)^2}=\frac{S^2}{s^2}\simeq 10^7$. We will therefore neglect the $-1$ in the following.
This equation has the following solution :
$$ h(t)=h(0)(1-t/t_m)^2 \text{ for } t\in[0, t_m]$$
and $h(t>t_m)=0$, with $t_m=\frac Ss \sqrt{2h(0)/g}$. Here $t_m=3\cdot 10^3 \sqrt(6/10) \sim 2000$ s. 
We have then $\mu(t)=m (1-t/t_m)^2$ and $f(t)=f(0)(1-t/t_m)$ with $f(0)=\rho s \sqrt{2gh(0)}\sim=10^{-2+3}\sqrt{60}\sim80$ kg·s⁻¹.
Conservation of the horizontal momentum
Now comes the interesting part of the problem, the horizontal movement. 
Momenta will be computed in the cart referential ($P^{CR}$) and in the rail referential ($P^RR$).If you look at the water inside the cart, its momentum will be
$$P^{CR}_{\text{water}}=\rho\int_{0}^{h(t)}dz S(z) v_h(z,t)$$
with $v_h(z,t)= dl/dz v_v(z,t)$.  From that and the expression $(*)$, we have
$$P^{CR}_{\text{water}}=- f(t) \int_{0}{h(t)}dz  dl/dz= f(t) (l(0)-l(h(t))).$$
Going back to the more physical rail-refrential, we have then 
$$P^{RR}_{\text{water}}=µ(t)v(t) + f(t) (l(0)-l(h(t)))$$
We also have, for the cart,
$$ P^{RR}_{\text{cart}}=M v(t)$$
As stated in other answers (but not my previous one :-(), one should not forget the momentum of the water which has left the cart in previous time :
$$P^{RR}_{\text{leaked water}}=\int_0^t d\tau f(\tau) v(\tau)$$
Summing these term, together with the momentum conservation, we have :
$$ 0=P^{RR}_{\text{total}}=(M+\mu(t))v(t) + f(t) (l(0)-l(h(t))) + \int_0^t d\tau f(\tau) v(\tau) $$
For example when the cart is empty, $f(t)=0$, $\mu(t)=0$ and the above equations becomes :
$$ 0=P^{RR}_{\text{total}}=Mv_{\text{final}} + \int_0^t d\tau f(\tau) v(\tau) $$
The cart can have a final nonzero speed, if its momentum is compensated by the net momentum of the water having left the cart. 
Differentiating the momentum conservation relatively to $t$, we obtain,
$$ 0=(M+µ(t))\frac{dv}{dt} - f(t) v(t) + \frac{df}{dt}(l(0)-l(h(t))) - f(t) \frac{dh}{dt} \frac{dl}{dz} + f(t) v(t)$$
This equation can be simplified into
$$ \frac{dv}{dt}=\frac{1}{M+\mu(t)}\left[\frac{df}{dt}[l(h(t))-l(0)] - \frac{dl}{dz}\frac{f(t)^2}{\rho S(h(t))}\right] $$
Knowing $f(t)$ as per the previous section allows us to integrate this equation, at least numerically, for any cart. In the following, we solve the equation for our cart geometry, distinguishing three steps.
Step 1: opening the nozzle
When the nozzle is quickly opened at $t=0$, the cart is full and $\mu=m$ is constant. the equation we have to solve is then
$$\frac{dv}{dt}=\frac{1}{M+m}\frac{df}{dt}l-0 $$
from which we easily deduce
$$\Delta v = \frac{l\Delta f}{M+m}=\frac{lf(0)}{M+m}.$$
With the numerical values above, this corresponds to a speed of 4 mm·s⁻¹. This movement of the cart compensate the internal acceleration of the water inside the cart towards the nozzle.
As wee will see later, this abrupt speed change is the biggest acceleration taken by the cart. If the nozzle is opened in one second, which is still quickly enough to keep $\mu=m$ approximation valid, the horizontal acceleration $a$ is still small : $\frac{a}{g}=4\cdot10^{-4}$.
Step 2: Emptying the cart above the nozzle
Above the nozzle, we have a constant $l(h)=0$ and the differential equation is
$$\frac{dv}{dt}=\frac{l}{M+\mu(t)}\frac{df}{dt}$$.
If the cart is emptied with a constant $f(t)$, it does not accelerate nor slow down, until the f(t) is cut. In that moment the back action is the same in a reverse direction, but with a lower mass. (M instead of M+m). We end therefore with a net speed towards the left of value $lf(1/(M+m)-1/M)$
In the more general case where f slowly decrease to 0, $df/dt <0$, implying a slow down, and indeed a reversal of the speed, since the total mass $M+µ(t)$ decreases.
If we plug into the above equation the values we have for $f(t)$ and $\mu(t)$, we have
$$\frac{dv}{dt}=\frac{lf(0)}{t_m(M+m(1-t/t_m)^2)}=-g\frac{ls^2m}{h(0)S^2M}\frac1{1+\frac mM(1-t/t_m)^2}$$
which can be analytically integrated using $\int dt/(1+t^2)= \arctan t$. We have then
$$v(t)-v(0)=-\frac{ls}{h(0)S}\sqrt{2gh(0)}\left[\arctan\sqrt{\frac mM} - \arctan\left(\frac{t_m-t}{t_m}\sqrt{\frac mM}\right)\right]$$.
We have then 
$$v(t_m)=v(0)-\frac{ls}{hS}\sqrt{2gh(0)}\arctan\sqrt{\frac mM}$$
In the limit $m\gg M$, where the mass of water is larger than the cart mass, $\arctan\sqrt{m/M}\simeq\pi/2$ and $v(0)=\sqrt{2gh(0)}\frac{ls}{h(0)S}$, so that :
$$v(t_m)=\sqrt{2gh(0)}\frac{ls}{h(0)S}(1-\frac{\pi}{2})$$
step 3: Showing that the nozzle has no influence, so long at it is small
The problem of the nozzle is the zone where $\frac{dl}{dz}$ is not small. let say that this zone is of height $\epsilon$, above a vertical pipe of height $\delta$, with $\epsilon\ll\delta\ll h(0)$. I have the intuition that the problem is not so dangerous, since the $\propto l/\epsilon$ derivative will be only relevant for a time proportional to $\epsilon$, and the small amount of water involved should keep the corrective term small. But I have nothing more rigorous yet :-(
A: Qualitative Answer
I think the cart exhibits an extremely surprising behavior.  The cart begins by sitting still on the track.  The hole is to the left of the center.  When the nozzle is opened, water in the cart begins a net flow to the left.  The cart, conserving momentum, picks up a velocity to the right.  In a steady state, the flow of water would be constant and the cart would move at constant velocity.  However, as the flow rate begins to decrease, the velocity of the cart decreases.  Eventually, the cart comes to a standstill, then actually reverses directions, moving to the left before the last water falls out.  When the last of the water is gone, the cart is coasting to the left.  The center of mass of the system never moves, because as the center of mass of the cart moves, the center of mass of the water moves oppositely.  Momentum is also conserved, because as the cart picks up momentum, the water picks up opposite momentum.  If the water also slides after hitting the track, by the end of the process the water will have a net motion somewhat to the right to compensate the motion to the left of the cart.
Quantitative Answer
Let the cart move at a speed $v$ to the right, and the water move at an average speed $w$ to the right.  In general, $v \neq w$ because the water's center of mass is moving relative to the cart.  The hole is at $l$.  If the hole is on the left then $l$ is negative.
The velocity of the water relative to the cart is $w-v$.  This velocity comes from the fact that the water, if it were to continue as it is now, would all move from the center of the cart to the hole, a distance $l$, in a time $m/f$, with $f$ the mass flow rate.  Thus the kinematic relation
$$w-v = \frac{lf}{m}$$
Next, we want to conserve momentum.  This gives
$$\frac{d}{dt}(Mv + mw) = 0$$
Taking this derivative, we have to keep in mind that $M$ and $m$ are changing because water is flowing out of the cart.  $m$ is decreasing at the rate $f$, and $M$ is increasing at the rate $f$ when we think of $M$ as the total mass moving at speed $v$ rather than the mass of the cart.  
$$M\dot{v} + m\dot{w} + f(v-w) = 0$$
Physically, the first two terms represent the force on the cart and the force on the water in the cart.  The last term represents the force on the water entering the nozzle.  Water entering the nozzle goes from $w$ to $v$, thus experiencing acceleration.  We have an earlier expression for $v-w$, so plug it in.
$$M\dot{v}+m\dot{w} = \frac{lf^2}{m}$$
I would like to solve for $\dot{v}$.  To do this, take the time derivative of the kinematic equation for $w-v$
$$\dot{w} - \dot{v} = \frac{l\dot{f}}{m} + \frac{lf^2}{m^2}$$
These last two equations simplify to
$$\dot{v} = \frac{-l\dot{f}}{M+m}$$
When the flow rate is constant, there is no acceleration.  This is plausible because we can imagine watching in a center-of-mass frame where the cart moves to the right and the water moves to the left.  The water entering the nozzle feels an acceleration, but the water in the cart is also accelerating, and in the opposite direction.  (The water in the cart is accelerating because there is less and less of it, so on average it must move faster to deliver the correct flow rate from the center of the cart to the nozzle.)
Right when we release the nozzle, the flow rate very quickly jumps up, and so the cart quickly picks up speed, too.  $m$ is essentially constant over the course of this acceleration, so the cart jumps up to a speed
$$v = -\frac{lf}{M+m}$$
If $m$ were to remain constant, we would find that this relation continues to hold, so that when the water stops flowing, the cart also stops.  However, $m$ is not constant; it decreases.  When the flow slows to a stop, the acceleration of the cart is now larger because $m$ is smaller.  Hence, by the time all the water has left the cart, it is actually moving to the left.  This is surprising but necessary - the water is mostly moving to the right because the cart initially moved to the right.  The cart must wind up moving left when all is said and done to compensate.
If we suppose the flow rate is constant the entire time, except abruptly beginning and ending (an assumption not in the original problem, which is qualitatively similar but more work to calculate), the final velocity of the cart is 
$$v_f = \frac{lfm}{M(M+m)}$$
The water is all flowing at the speed the cart originally jumped to,
$$w_f = -\frac{lf}{M+m}$$
so we see that momentum is conserved.
A: Here is my attempt. I went to a somewhat different path than kalle43 and this is a little easier i think.
Let $x(t)$ be the coordinate of the nozzle  at time $t$. Consider an infinitesimal mass of water $dm$ departing the nozzle at time $\tau$ : $$dm=-m'(\tau)d\tau$$ Here $m'(t)$ denotes the time derivative of the mass of water inside the tank.
Let $x(\tau)$ be the horizontal coordinate of $dm$ at time $\tau$. Then at time $t>\tau$ the horizontal coordinate of $dm$ will be: $$x(\tau)+(t-\tau)x'(\tau)$$ Here $x'(t)$ denotes the time derivative of the coordinate of the nozzle  at time $t$ or simply velocity of the wagon.
Now sum $x_idm_i$ (static moment of mass) over all infinitesimal particles emitted from the nozzle within the time period $(0...t)$  will be expressed by the integral:
$$-\int_0^t [x(\tau)+(t-\tau)x'(\tau)]m'(\tau)d\tau$$ The following step is to get static moment of mass of the wagon with water inside it. This is a simple:$$[l+x(t)][M+m(t)]$$ Now the static moment of mass of the whole system(the wagon with water + emitted water) is expressed as the sum of  last two expressions:
$$-\int_0^t [x(\tau)+(t-\tau)x'(\tau)]m'(\tau)d\tau+[l+x(t)][M+m(t)]=pt+c$$ $p=const$ and $c=const$
Now you ask what means $pt+c$.This becomes clear when we differentiate the last equation with respect to $t$:  $$-\int_0^t x'(\tau)m'(\tau)d\tau- x(t)m'(t)+x'(t)[M+m(t)]+m'(t)[l+x(t)]=p$$ $p=const$
This result represents the  horizontal momentum of the whole system(the wagon with water + emitted water). This must be conserved. So $c$ is simply integration constant.
Now the most important part follows:
Consider the initial moment $t=0$. At this moment let the coordinate of the nozzle be zero:$(x(0)=0)$ as well as the initial velocity of the wagon:$(x'(0)=0)$. Then the momentum equation gives:
$$lm'(0)=p=const$$
What can we conclude from this result? First, before the opening of the nozzle the momentum of the whole system(wagon+water inside it) is definitely zero. But after opening, at $t=0$ the momentum remains zero only if $m'(0)=0$. Otherwise it suddenly becomes different from zero. And this last is realized in the given problem. The momentum of the whole system(the wagon with water + emitted water) becomes different from zero and the wagon starts to move in one direction.
But if $m'(0)=0$ then Mark Eichenlaub's scenario will start, i think.
Now let's differentiate the momentum equation with respect to $t$ to get the equation of motion of the wagon: $$[M+m(t)]x''(t)=-lm''(t)$$ Actually, I was shocked that the equation turned out to be as simple.
Edit
I drifted from Torricelli's law and added an example which confirms quantitatively Mark Eichenlaub's qualitative answer. This shows also that the law of conservation of energy is irrelevant  in this problem.
Only the mass change of the wagon does matter.
I picked a function $m(t)$ such that $m'(0)=0$. So there is no need to worry about any instantaneous jump at $t=0$ and the horizontal momentum remains zero.
$$m(t)=\frac{m}{2}\left(1+cos\frac{\pi{t}}{T}\right);0\leq t\leq T$$ and the equation of motion:
$$[M+m(t)]x''(t)=-lm''(t)$$ The solution of the equation:
$$\dot{x}(t)=\frac{l\pi^2}{T}\left(\frac{t}{T}-\frac{2 }{\pi}\frac{\eta+1}{\sqrt{{2\eta+1}}}\arctan\frac{tan\frac{\pi{t}}{2T}}{\sqrt{2\eta+1}}\right)$$ where $\eta=\frac{m}{2M}$
This solution  follows closely by the behavior Mark gave. Final velocity is directed to the left $(v_f<0)$ and is given by the expression:
$$v_f=\frac{l\pi^2}{T}\left(1-\frac{\eta+1}{\sqrt{{2\eta+1}}}\right)$$
A: Interesting problem. I think my approach and answer is very close to other posted solutions. I also added a possible scenario. The basic summary is it is the change in the average momentum of the water in the wagon that causes the wagon to move.  Requiring the water to distribute it self evenly in the wagon causes this relation:


*

*average momentum of water in the wagon = $l\times$ mass flow out of wagon


In cases where the wagon has been and forever shall expel water at a constant rate, the wagon stands still. Imagine it being refilled from above its center of mass. You can actually do this same problem with an empty cart being filled from above instead of emptying below. With $l$ being the horizontal point from the wagon's center of mass at which the water falls down.
The wagon does move if there is some fluctuation in the mass flow out of the wagon either by abrupt starts/stops or by running out of water.

Variables


*

*$t_{c}\to$ time when wagon runs dry

*$l\to$ distance from center of mass of wagon to nozzle, positive $l$ implies nozzle is on the right side of the wagon

*$x(t)\to$ center of mass of wagon

*$x_{cm}(t)\to$ center of mass of everything

*$h(t)\to$ height of water in the container

*$m(t)\to$total mass of the wagon including any water it holds

*$m_{w}\to$ mass of initial water

*$m_{c}\to$ mass of the wagon; the c is for the critical point of $m(t)$ when all the water is gone.
Originally c was for container but it makes sense $m(t_{c})=m_c$
Frame of Reference


*

*$x(0)=0$

*$\dot{x}(0)=0$



Drainage
I'm going to side step the issue of initial conditions for now. I'm going to treat the system as if the nozzle was always open and water has always been running. Only concerned with how a container with a constant cross section, S, would drain.


*

*Torricelli's Law : Mass Flow =$-\dot{m}(t)$ : Mass of System


$$v(t)=\sqrt{2 g h(t)}$$
$$-\dot{m}(t)=\rho s v(t)$$
$$m(t)=\rho S h(t) + m_{c}$$
Combine to eliminate $m(t)$ and $v(t)$
$$\frac{\dot{h}}{\sqrt{h(t)}}=-\frac{s}{S}\sqrt{2 g}$$
The answer to the differential equation:
$$h(t)=h(0){\left(1-t\sqrt{\frac{g {s}^{2}}{2 {S}^{2} h(0)}}\right)}^{2}$$
$$h(t)=h(0){\left(1-\frac{t}{t_{c}}\right)}^{2}$$
where $t_{c}=\sqrt{\frac{2 {S}^{2} h(0)}{g {s}^{2}}}$ and $h(t>t_c)=0$
from there we get $m(t)$:
$$m(t)=\rho S h(0) {(1-\frac{t}{t_{c}})}^{2} + m_{c}$$
$$m(t)=m_{w} {(1-\frac{t}{t_{c}})}^{2} + m_{c}$$
and for $m(t>t_{c})$ is simply $m_{c}$, the mass of the wagon

Center of Mass
In order to find the center of mass we will account for all of it. At $t=0$, $x_{cm}(0)=x(0)$=0 since all the mass is in the wagon and we assumed equally distributed.


*

*The Wagon and its contents
$$m(t)x(t)$$

*Water that has left the wagon


If water leaves the the wagon at $t=\tau$, then it will have speed $\dot{x}(\tau)$. Therefore its location is $f(t,\tau)$:
$$f(t,\tau) = l+x(\tau)+\dot{x}(\tau)(t-\tau)$$
Then we just integrate to get their contributions.  We get their infinitesimal masses from our mass flow:
$$\int_0^t f(t,\tau) [-\dot{m}(\tau)]d\tau$$


*

*Combine
$$m(0)x_{cm}(t)=m(t)x(t)-\int_0^t f(t,\tau)\dot{m}(\tau)d\tau$$


Differentiating gives us:
$$m(0)\dot{x_{cm}}(t)=\dot{m}(t)x(t)+m(t)\dot{x}(t)-f(t,t)\dot{m}(t)-\int_0^t \frac{df(t,\tau)}{dt}\dot{m}(\tau)d\tau$$
Simplifying:
$$f(t,t)=x(t)+ l$$
$$\frac{df(t,\tau)}{dt}=\dot{x}(\tau)$$
Integration by parts:
$$\int_0^t\dot{m}(\tau)\dot{x}(\tau)d\tau=m(t)\dot{x}(t)-\int_0^tm(\tau)\ddot{x}(\tau)d\tau$$
Repalce:
$$m(0)\dot{x_{cm}}(t)=\dot{m}(t)x(t)+m(t)\dot{x}(t)-\dot{m}(t)(x(t)+ l)-m(t)\dot{x}(t)+\int_0^tm(\tau)\ddot{x}(\tau)d\tau$$
Explanation - In order these terms stand for:


*

*mass dissapearing from wagon at the center of mass

*momentum of wagon and its contents

*mass appearing outside of wagon at the nozzle

*last two terms account for momentum of water outside of the wagon


Combining the first and third terms gives us the average momentum the water in the wagon must have to maintain its even distribution horizontally in the container.  They are not evidence for instantaneous dissapearance from the center and reappearance at the nozzle.
Result:
$$m(0)\dot{x_{cm}}(t)=-\dot{m}(t) l+\int_0^tm(\tau)\ddot{x}(\tau)d\tau$$
where:
$$m(t)=m_{w} {(1-\frac{t}{t_{c}})}^{2} + m_{c}$$

Wagon w/ Brakes
In this scenario, the wagon has been losing water before $t=0$.  However the force of the brakes keeps $\dot{x}(t)=0$. At $t=0$ the brakes are released and it is allowed to move.  This avoids any instantaneous jump in velocity by the wagon.  It also allows $x_{cm}$ to be a non-zero constant after $t=0$.
Setting $t=0$:
$$m(0)\dot{x_{cm}}(0)=-\dot{m}(0) l+\int_0^0m(\tau)\ddot{x}(\tau)d\tau$$
$$m(0)\dot{x_{cm}}(0)=-\dot{m}(0) l$$
$$\dot{x_{cm}}(0)=-\frac{\dot{m}(0)}{m(0)} l$$
$$\dot{x_{cm}}(0)=\frac{2 l m_w}{t_c m(0)}$$
For $t>0$ there is no force from the brakes:
$$\ddot{x_{cm}}(t\ge0)=0$$
$$\dot{x_{cm}}(t\ge0)=\frac{2 l m_w}{t_c m(0)}$$
In other words in this situation at $t=0$ the momentum of the whole system matches that of the water in side the wagon. The only question now is as time evolves how is that momentum transfered to the wagon and water leaving the moving wagon.
Differentiate the system's momentum:
$$m(0)\ddot{x_{cm}}(t)=-\ddot{m}(t) l+\frac{d}{d t}\int_0^tm(\tau)\ddot{x}(\tau)d\tau$$
$$0=-\ddot{m}(t)l+m(t)\ddot{x}(t)$$
$$\ddot{x}(t)=\frac{\ddot{m}(t)l}{m(t)}$$

Physical Considerations
Therefore we have a simple system as long as $\ddot{m}(t)$ is continuous.    The physical explanation is that if we abruptly closed the nozzle the water in the wagon does not come to an immediate stop relative to the wagon.  It sloshes around and after a certain relaxation time redistributes its momentum to the system as a whole. Similarly with the quick turn on, the water in the container can't just gain an average momentum to match $-\dot{m}(t)l$. Again there must be some relaxation time for the water to hit that equilibrium where it can evenly distribute itself in the wagon.  It is not that these situations are impossible but that my equations would not take into account these relaxation times.
My situation just avoids that. The water in the wagon has already hit some equilibrium before $t=0$.  Also having the water move under its own weight provides a slow turn off.

Velocity of Wagon
Combining the results from previous sections:
$$\ddot{x}(t)=\frac{2\frac{m_w}{{t_c}^2}l}{m_{w} {(1-\frac{t}{t_{c}})}^{2} + m_{c}}$$
$$\ddot{x}(t)=\frac{2 l m_w}{{t_c}^2 m_c}{\left[\frac{m_w}{m_c}{(1-\frac{t}{t_c})}^{2}+1\right]}^{-1}$$
$$\int\frac{du}{1+u^2}=\arctan(u)$$
$$u=\sqrt{\frac{m_w}{m_c}}(1-\frac{t}{t_c})$$
$$\dot{x}(t)=-\frac{2 l}{t_c}\sqrt{\frac{m_w}{m_c}}\int\frac{du}{1+u^2}$$
$$\dot{x}(t)=\frac{2 l}{t_c}\sqrt{\frac{m_w}{m_c}}\left[\arctan\sqrt{\frac{m_w}{m_c}}-arctan\sqrt{\frac{m_w}{m_c}}\left(1-\frac{t}{t_c}\right)\right]$$

Extremely Heavy Wagon: $\sqrt{\frac{m_w}{m_c}}\ll1$
$$\arctan(x)\to x-\frac{1}{3}x^3$$
$$\dot{x}(t_c)=\frac{2 l m_w}{t_c m_c}$$
$$\dot{x_{cm}}(t\ge0)=\frac{2 l m_w}{t_c m(0)}$$
This makes physical sense.  The wagon's final momentum is just about equal to our initial momentum. The higher order terms would account for the momentum that the dispensed water has.

Regular Wagon:  $\sqrt{\frac{m_w}{m_c}}\gg1$
$$\arctan(x)\to \frac{\pi}{2}$$
$$\dot{x}(t_c)=\frac{\pi l}{t_c}\sqrt{\frac{m_w}{m_c}}$$
$$\dot{x_{cm}}(t\ge0)=\frac{2 l m_w}{t_c m(0)}$$
$$p_{cm}(t\ge0)=\frac{2}{\pi}\sqrt{\frac{m_w}{m_c}}p(t)$$
This case has the wagon with a significantly smaller portion of the systems momentum.

A: This answer presents an analogy that I hope will clarify how it is possible that 1) the wagon moves 2) the wagon winds up with a net velocity at the end of the problem.  This isn't a direct answer - it's intended as supporting conceptual material (so I've marked it community wiki).
Setup
Throughout this answer, all velocities and all momenta are calculated solely in the reference frame of the rail.
Imagine that the tank does not have water in it.  Instead it has a gun that shoots clay lumps. The gun is mounted at the middle.  It can shoot any size clay lump at any speed.
There is a hole in the wagon floor.  For convenience, the hole is all the way at the left side of the wagon.  If the gun shoots a lump of clay to the left, the gun, which is rigidly attached to the rest of the wagon, will recoil some.  The lump will fly towards the left side of the wagon and collide with the left wall completely inelastically.  Then it will fall down through  the hole in the floor and exit the wagon with exactly the same horizontal speed (if any) as the wagon.
First experiment
The tank starts out stationary with a lump of mass $m$ in the gun.  It shoots the lump at speed $v$.  The lump is moving to the left; $v$ is negative.  The momentum of the lump is $mv$.  Let the recoil speed of the wagon be $w_0$.  By conservation of momentum, $mv + Mw_0 = 0$.  Therefore, the cart recoils, moving at speed 
$$w_0 = -v*m/M$$, 
which is to the right.
Next, the lump collides with the left wall.  At this point the lump and wagon must move at some new, mutual speed after the collision.  Call that $w_f$.  Conservation of momentum implies $w_f = 0$ and the wagon has come to a dead stop.  The lump  falls through the hole straight down and the wagon sits still for the remainder of eternity.  It is displaced from its original position.
Second Experiment
The tank starts out with two lumps of clay in the gun, each of mass $m/2$.  The gun shoots one lump at speed $v$ as before.  Conservation of momentum gives $m/2*v + (M+m/2)*w_0 = 0$, or 
$$w_0 = -v\frac{m}{2(M+m/2)}$$
Next, we wait until the moment when that lump hits the left wall.  At precisely that moment, we fire the next lump, also at speed $v$.  We make the acceleration profiles of the two lumps exactly equal in magnitude and opposite in sign.  This way, the forces on the two lumps must be equal.  Those forces come from the rigid body of the gun and wagon combined.  Hence, the gun/wagon feels no net force and no acceleration during this process.
The first lump is now comoving with the wagon at speed $w_0$.  It falls through the hole moving at that speed.  
Next, the second lump collides with the wagon.  The second lump and the wagon come to some mutual velocity $w_f$.  Conservation of momentum gives $mw_0/2 + (M + m/2)w_f = 0$, or
$$w_f = -w_0 \frac{m}{2(M+m/2)}$$
or substituting in for $w_0$
$$w_f = v \left(\frac{m}{2(M+m/2)}\right)^2$$
The second lump falls out of the wagon and moves at speed $w_f$, and the wagon coasts at speed $w_f$ from then on.  $w_f$ is proportional to $v$ and has the same sign.  The wagon is moving to the left at the end of the process.
A: My answer below is wrong: it doesn't take into account the momentum of water leaving the cart once it has started moving.
Basically, by conservation of the horizontal momentum in the absence of any horizontal force, the speed of the wagon at the end will be 0.  However, the position of the centre of mass of the (Wagon+Water) system should also be conserved, so the wagon will move slowly to the right during the process, which can probably be linked to a pressure difference inside the tank. But it will stop by the time the Wagon is empty.
The real question is therefore not the final speed, but the final displacement. Let x be the current position of the Wagon's centre of mass. When a mass -dµ of water goes through the nozzle, its centre of mass is displaced by l to the left, and the centre of mass of the wagon is displaced by -l·dµ/(µ+M) to the right, where µ is the remaining mass of water inside the wagon.
Integrating this gives
$$\Delta x=-l\int_m^0\frac{\mathrm d\mu}{\mu+M}=l\ln\frac{m+M}M $$.
Of course, if the wagon moves initially to a (non-relativistic !) speed, the previous analysis stays true in the moving reference frame. The speed will not change, but the wagon will have a Δx advance compared to a wagon with the same initial speed, but a closed nozzle   
Edited to correct a sign error*strong text*
A: With a vertical jet, Torricelli's law still holds because the displacement of the wagon is orthogonal to the acting forces, gravity plus (arguably, but orthogonal in any case) reaction force, so no work is used by the wagon, $\Delta W = {\bf F} \cdot {\Delta \bf x}=0$  and all the energy still goes to the water jet.
Thus we can calculate $m(t)$ as usual. Forget the drawing and use a square tank. The one in the drawing was calculated by Kepler, and it complicates the problem. Let the height of the water to be simply $h(t)={m(t)\over \rho S}$, ok? And $2 g h(t)$ is the square speed of the jet, the variation of mass follows $ m'(t)= - \rho s \sqrt { 2 g h(t)}$, and at the end we have 
$$ m'(t) = - \sqrt {2 g \rho s^2 \over   S} \sqrt{ m(t)} $$
Which solves to $m(t)= m (1 - t \sqrt {g \rho s^2 \over 2 m S})^2 $ and tell us that the tank becomes empty at $t_f=\sqrt {2 m S \over g \rho s^2 }=\sqrt {2 h S^2  \over g s^2 }$.
We can plug this into Frederik "wrong" solution $x(t)= l \ln {m+M \over m(t)+M}$ t o get the displacement 
$$ x(t) = l \ln {m+M \over (1 - t/t_F)^2 m +M}$$
and the velocity
$$ \dot x(t)=  { 2 m l \over t_F} { (1-t/t_F) \over (1 - t/t_F)^2 m +M }
= { 2 l (t_F-t) \over (t_F - t)^2 + {Mt_F^2 \over m} }$$
Note that in the limit of $M \ll m$, we get
$ \dot x(t)=  { 2 l \over (t_F - t)  } $ and thus $ \ddot x =  { 2 l \over (t_F - t)^2  }$, similar to other answers. Note that in this limit the speed at $t_F$ is infinite, but it is massless, so we can stop it anyway.
Another curious issue is that
$ \dot x(0) = { 2 l \over t_f (1 + M/m)} $
is not zero. It sounds strange, but consider that the initial speed of the jet is not zero neither.

Before to consider variants of Frederik solution, it is important to note that we have four blobs of mass playing some role.


*

*the leaked water, $m-m(t)$

*the leaking water, $\Delta m= - m'(t) \Delta t$

*the cart mass, M

*the wagon water, m(t)


In the leaking process, the leaked water is already inertial, will a horizontal momentum (in the railway direction) equal and opposite to the momentum of the other three masses, Or, for small $\Delta t$, equal to  $- (M + m(t)) V_{c+w}$. The questions to be fixed are: 1) which is the actual direction of the force by the water and the leaking water horizontal velocity: the velocity of the cart, the one of the CM of the water, or some other one? and 2) Does the acceleration of the cart changes enough the direction of "gravity" inside the cart (remember your last bus trip) to be considered a major perturbation of the problem? 

Point 2 is most probably a red herring, at least in the approximation where $M \ll m(t)$, because in such case we don't have reasons to expect the accelerations of the cart and the [CM of the] water inside to be different. Remember that the "horizontal gravity" inside the wagon will be the difference of these accelerations. 
A: Some years later...  I am reviewing this problem mostly for my own benefit, But it could be useful if somebody is still wanting to discuss the answers, particularly without any braking system.
let me start with an alternative wrong solution, aka a variation: allow the system to drop the water without horizontal velocity, for instance using a periodic obturator or a refilling system such that first a quantity $\delta m$ of water is expelled without disturbance, then the resultant bubble is liberate and some short time for the system to relax is allowed.
In this solution, obviously the cart moves away from the nozzle side, i.e to the right, to keep the original CM. The move is such that  
$\delta x = l {\delta m  \over M-\delta m}  \approx l {\delta m  \over M}  \approx - l { m'(t)   \over m(t)}  \delta t  $   
where the last step is no doubt a bit tricky given that our initial postulate is that $m(t)$ is a multiple step function and we are approaching it with a differentiable function. The point of the approximation is that we can then solve for the speed of the wagon. 
$\delta x = - l {d \ln m(t) \over dt }\delta t$
$x(t)=   l  \  \ln({m(0) \over m(t)})$  
and then in this variation the wagon stops when $m(t)=m_c$ and there is not more water to drop, no more CM to correct:
$x_f =  l  \  \ln({m_w + m_c \over m_c})$
Note that I am using mass values from the accepted solution, but $l$ from the original question. To be clear: the nozzle was in the left side of the wagon, the wagon has coasted left until it stopped, and it actually stopped because a cunning device was making sure that the water was launched without horizontal speed. Note also the difference against a single dropping operation where all the water $m_w$ is deployed at the zero coordinate; then $x_f = l\  m_w/m_c$. 

Now lets add horizontal speed. From the instant that we allow some water to coast indefinitely right side, we will need to find in the solution at least one point where the wagon actually reverses move and starts to coast left.
To keep fixed the CM, nothing beats the equation from the chosen answer
$0=\dot{m}(t) l+\int_0^tm(\tau)\ddot{x}(\tau)d\tau$
which differentiates to
$0=\ddot{m}(t) l+ m(t)\ddot{x}(t)$
$\ddot{x}(t) = - l {\ddot{m}(t) \over m(t)}$
and the real deal is that even for a constant acceleration in the mass of leaked water the denominator makes the result more colourful. I think, comparing with the move in the "water drop" case, that it can be interpreted telling that the wagon needs an extra momentum $l \  m'(t)$, thus an extra force $l\  m''(t)$ that translates to an extra acceleration $l\  m''(t)/m(t)$. But this is just an interpretation and really the equation is almost the expected from dimensional analysis -as the original poster did suggested indeed- so various interpretations could be fitted.
As for initial conditions, it has sense to ask $x'(0)=-l m'(0)/m(0)$ not only because it is the speed in the car in the approximation with multiple steps system, but also because it is compatible with the CM condition taking x''(t) a dirac delta in t=0.

Lets try an example where the initial speed of flow and wagon are zero. To do this, instead of a brake we can use a function $m(t)$ that reaches the Torricellian regime at $t_0$, using initially some extra water $m_{nt}$ and a controlled pumping. So in the starting phase we have
$t < t_0 : \ddot{m}(t) = -{2m_w \over t_c t_0} :  \dot{m}(t) =-{2m_w \over t_c t_0} t   : m(t)= m_c+m_w+m_{nt}- {m_w \over t_c t_0} t^2$
Note that the extra water is thus $m_{nt} = m_w (t_0/t_c)$
When we enter the question regime we change sign of the acceleration
$t_0 < t < t_c + t_0:  \ddot{m}(t) = {2 m_w \over t_c^2} :  \dot{m}(t) =   - 2 {m_w \over t_c} (1-\frac{t-t_0}{t_c}) :m(t)=m_{w} {(1-\frac{t-t_0}{t_{c}})}^{2} + m_{c} $
and of course finally  
$ t_c +t_0 < t : \ddot{m}(t) =0 :  \dot{m}(t) =0 : m(t) = m_c  $     
so that the final speed of the wagon will be the integration
$
\dot x(t_0+t_c) =  
 l \int_0^{t_0} {{2m_w / t_c t_0} \over {m_c+ m_w (1 + t_0/t_c) - {m_w \over t_c t_0} t^2}}
- l \int_{t_0}^{t_0+t_c} {{2 m_w / t_c^2} \over {m_w {(1-\frac{t-t_0}{t_c})}^{2} + m_c}}$
$=  
 2l (\int_0^{t_0} {{1 / t_c t_0} \over{ \frac{m_c}{m_w}+ (1 + t_0/t_c) - {1 \over t_c t_0} t^2}}
-  \int_{t_0}^{t_0+t_c} {{1 / t_c^2} \over { \frac{m_c}{m_w}+ {(1-\frac{t-t_0}{t_c})}^2 }})$
$=  
 2l (\int_0^{t_0} {1 \over{ t_c t_0 \frac{m_c}{m_w}+ (t_c t_0 + t_0^2) -  t^2}}
-  \int_{t_0}^{t_0+t_c} { 1 \over { t_c^2 \frac{m_c}{m_w}+ {(t_c-(t-t_0))}^2 }})$
TO BE CONTINUED
A: Adding another answer here mainly to document the known sources of this problem. Further references can be checked in https://arxiv.org/abs/2001.09807, The physical leaky tank car problem, by S. Esposito and M. Olimpo. It seems the analysis was first published in 
McDonald, K. T. (1991). Motion of a leaky tank car. American Journal of Physics, 59(9), 813–816. doi:10.1119/1.16728
where it is said to be a Russian exam problem. While the AJP is paywalled, some classroom notes are available at http://physics.princeton.edu/~mcdonald/examples/tankcar.pdf
McDonald already mentions that "the final velocity of the tank car must be opposite to its initial velocity" so that total horizontal momentum is zero. His answer, in the notation of the OP, is that the final speed is proportional to
$$
 ( - {\sqrt m \over m + M} + { 1 \over \sqrt M} arctan \sqrt {m \over M})
$$
On the other hand, the non-Torricellian, constant flow rate is argued to have a final velocity proportional to 
$$ - {m \over M} { l \over m + M} $$ 
due to a transient force at the time when the tank is emptied.
For the torricellian case, he also calculates the "critical mass" $$ M = 0.255 m$$ of the car respect to the water mass in order for it to just stop at the same initial position.
A: Clearly the water going out of the nozzle does not contribute any horizontal momentum change. Initially the wagon is still and the water flows downward.
The only reason why the wagon could move is that there is a force acting on the right size of the nozzle as the water hits it and its direction is turned towards the floor, thus exerting a force.
But let's think about this. How can we calculate this force? The force is equal to the pressure of the water times the vertical cross section area of the nozzle.
However, the water pressure is the same on the side with the nozzle and the side without. The force on the left side of the nozzle is compensated by an equal force on the right side of the wagon.

The forces on the left are exactly canceled by the ones on the right. F3 is canceled out by -F3 acting on the left side of the tap.
If there were no left side of the tap we would have a net horizontal force (the wagon would be propelled by recoil), but having a left side keeps the wagon still.
It's clear to me that there will be, in real life, second order effects like unbalances in the density of the water which could make the wagon oscillate or move. But the question clearly states that the water remains horizontal (therefore undisturbed) and that Torricelli's law applies. This only happens when the outward flow is so slow that any inhomogeneities in density are second order effects and the water can be treated as to always have a laminar flow.
In any case the system is analogous as standing on a frictionless surface. Short of throwing something outwards, one wouldn't be able to propel. Throwing something downwards wouldn't help.

Edit
To address Mark's and Marek's concern about the conservation of momentum, I can say this:


*

*the water, internally, initially falls down and gains vertical momentum

*at some point it will necessarily turn left. The momentum will not change in magnitude, but in direction: from down to left. This creates a reaction force on the bottom and on the right side.

*at the final point (the nozzle): the water will turn down again, from left to down. This creates a reaction force on the top of the nozzle and on the left of the nozzle

*since the water flows vertically w.r.t. wagon, it has zero horizontal momentum at the exit point

*this constraint implies that the left hand force and the right hand force compensate.

*instead, there will be a torque. I have not calculated this, but depending on the length of the tube, this torque could eventually make the wagon tilt (if the weight of the tube remains negligible). Normally, though, the torque will not have a movement effect, it would merely move the center of mass towards the right.


To understand this a bit better:


*

*Imagine the same problem without the nozzle

*Water flows freely left, horizontally.

*The water flows out with a speed of $v(t)=\sqrt{2gh(t)}$ and a horizontal momentum that can be calculated via the parameter $s$ and $v(t)$, and a vertical momentum of zero

*The wagon's horizontal momentum momentum changes by the same amount, opposite sign

*The wagon recoils right


Now


*

*Re-imagine the original problem, with the nozzle

*Water flows freely downwards, vertically

*The water flows out with a speed of $v(t)=\sqrt{2gh(t)}$ and a vertical momentum that can be calculated via the parameter $s$ and $v(t)$ and a horizontal momentum of zero

*The wagon's horizontal momentum changes by the same amount, which is zero

*The wagon stays still

A: A quantitative answer
The three main conservation laws of fluid mechanics are


*

*Conservation of mass

*Conservation of momentum

*Conservation of energy


Reference
Between the time $t$ and $t+\mathrm{d}t$ a mass of water $\mathrm{d}m(t)$ escapes through the nozzle. The mass escapes at a speed governed by Torricelli's law - obtained through 1. and 3.:
$$v(t) = \sqrt{2gh(t)}$$
The direction of the water is determined by the inclination of the nozzle $\theta$ which we may generalize to vary from $0$ radians (horizontal, pointing left) to $\frac{\pi}{2}$ (vertical, pointing down).
$$\mathbf{v}(t) = -v(t) \pmatrix{ \sin \theta \\ \cos \theta }$$
The momentum of the water flowing out is determined by
$$ \mathbf{p}(t) = m(t) \mathbf{v}(t) = -m(t)v(t) \pmatrix{ sin \theta \\ cos \theta }$$
$$ \mathbf{p}(t) = p(t) \pmatrix{ sin \theta \\ cos \theta }$$
Since the fluid is incompressible and mass is conserved, the mass flowing out corresponds to an equivalent decrease in the amount of water from the top.
$$ \mathrm{d}m(t) = \rho S \mathrm{d}h(t)$$
But also, the water will flow at a speed $v(t)$ at the nozzle, so the water that escapes is
$$ \mathrm{d}m(t) = \rho s v(t)\mathrm{d}t$$
Therefore
$$S \mathrm{d}h(t) = s v(t)\mathrm{d}t$$
or
$$ \mathrm{d}h(t) = \frac{s}{S}v(t)\mathrm{d}t$$
Plugging in the equation for $v(t)$ and introducing $\sigma=\frac{s}{S}$
$$ \mathrm{d}h(t) = -\sigma \sqrt{2g h(t)} \mathrm{d}t$$
solving this first-order nonlinear ordinary differential equation and using $h_0 = h(t=0)$ and $v_0 = v(t=0) = \sqrt{2gh_0}$
$$h(t) = \frac{1}{2}g\sigma^2t^2 - v_0\sigma t+h_0 \approx h_0 - v_0\sigma t$$
This lets us find $v(t)$, $m(t)$ and $\mathbf{p}(t)$:
$$v(t) \approx -\sqrt{2gh_0 - 2gv_0\sigma t}$$
$$\frac{\mathrm{d}m}{\mathrm{d}t} = \rho s v(t) \approx - \rho s \sqrt{2gh_0 - 2gv_0\sigma t}$$
Which is solved by the (approximate) solution:
$$m(t) \approx m(t) = C +\frac{2 \rho s \sqrt{2g} (h_0-\sigma v_0 t)^{\frac{3}{2}}}{3 \sigma v_0}$$
Note: an analytical solution exists, but it's really ugly
To calculate $C$ we must use the condition that when all the water is gone, $m(t) = 0$. To do so we can solve:
$$0=h(t)\approx h_0 - v_0\sigma t \implies t_f \approx \frac{h_0}{v_0 \sigma}$$
then,
$$0 = m(t = t_f) = C +\frac{2 \rho s \sqrt{2g} (h_0-\sigma v_0 \frac{h_0}{v_0 \sigma})^{\frac{3}{2}}}{3 \sigma v_0}\implies C=0$$
therefore
$$ m(t) \approx \frac{2 \rho s \sqrt{2g} (h_0-\sigma v_0 t)^{\frac{3}{2}}}{3 \sigma v_0} $$
finally, the magnitude of the linear momentum is given by:
$$ p(t) = m(t)v(t) \approx -\frac{2 \rho s \sqrt{2g} (h_0-\sigma v_0 t)^{\frac{3}{2}}}{3 \sigma v_0} \sqrt{2gh_0 - 2gv_0\sigma t}$$
Let's see the effect of the two components of $\mathbf{p}$. The horizontal component propels the wagon by reaction; the vertical component creates a torque that pushes the center of mass to the right - note that the flow pushes the center of mass to the left.
If $\theta = 0$, all the linear momentum is horizontal. There is no torque, the wagon will move by reaction and the center of mass doesn't move because the water flowing out and the wagon move in opposite directions:
$p_{wagon} = p(t)$
If $\theta = \frac{\pi}{2}$ all the linear momentum is vertical. There will be a torque but no horizontal movement, as there is no horizontal momentum. This implies that the contributions to the center of mass by the water flowing out and the torque must cancel out.
Finally, if $\theta$ has a middle value, a compositions of the two behaviours will occur.
In regards to the problem, $\theta = \frac{\pi}{2}$ and therefore the wagon will not move
A: Short version: movement inside the closed system cannot accelerate it. Zero horizontal speed at exit means zero speed at t->infinity. 

More detailed version:
Let me transfer the problem to a simpler one:
We have an open wagon with me standng on one side of it holding a heavy box. Now I will start running towards the other side of the wagon. This will cause the wagon to move in the opposite direction. 
At a certain point I will have to decelarate so that I stop at the other side of the wagon. This will create eqaual force to accelerating thus compensating any speed that developed during the accelerating. 
The position of the wagon will be changed so that the center of mass will not have moved. The speed will be equal to starting speed. 
Now I drop the box straight down. (I will use a bit of force to simulate the water pressure, 
 but that is not important) Speed is zero, wagon moved box is down. 
Now, let's say I have multiplied, have negligible weight and the box is a molecule of water. The final speed will be certainly zero again. The question is, what the displacement of the wagon will be. I have two answers and cannot choose either:


*

*The centre of mass has to be kept the same (horizontally, gravitation can move it vertically down). This determines the final position of the wagon. 

*The final displacement is speed integrated over time. Now for each molecule that will start moving left, there will be one stopping at the nozzle. This would compensate the forces in real time keeping the speed at zero and so the displacement. 


Please correct me if my analogy is wrong at some point and try to answer the question about final displacement. 
Edit - more explanations
Assuming the wagon moves during the process it's true that the water will have a momentum relative to rail and it will travel at the same speed as the wagon. That means there will be no net force from this water coming down. 
Imagine a very long tube open on both sides filled with water. If you put this tube vertically in a homogeneous gravitation field the water will flow (fall) out of it. If it moves at a constant speed the water would behave the same relative to the tube. The outside observer would see a tube moving to the side and a column of water moving down and to the side (at the same speed, so it would stay under the tube all the time). The same goes for the water from the nozzle: it will always have the same horizontal speed as the wagon at the point of leaving thus having no effect whatsoever on its movement. This is true disregarding the speed of the wagon. 
Having said this the only forces affecting the whole water-wagon system are those caused by the internal movement of water. On this frictionless rail you can change the wagon's position from inside only at the cost of regrouping the stuff inside (changing the mass distribution through the system). Someone (let's say a lobster) walking on a wagon (of zero weigh for simplification) on a frictionless rail cannot move relative to the rail. It is the same as if this lobster was trying to walk on frictionless ice: there would be no reactive force to move him. Looking at the lobster on the zero-weight wagon we would see a lobster walking, though not moving, and a wagon moving under him. As the only mass in this system is the lobster, the centre of mass would not move. 
Returning to the water - after opening the nozzle the water starts moving to the left and because there was no speed at t=0 there had to be some acceleration. than the water is gradually moved towards the left end of the wagon where it loses its horizontal speed and leaves the wagon at zero horizontal speed. While stopping the decelerating will compensate any forces (and speed) created during the acceleration. Whether this is going on at zero or non zero speed relative to the rail has no influence. 
As we have no external force in the horizontal direction, there centre of mass has to stay unmoved (which requires the wagon to move). At the same time the zero momentum of the water train system has to be preserved so unless the water leaves the train with non-zero horizontal speed relative to the wagon the wagon cannot end up with non-zero horizontal speed relative to the water expelled. 
A: As the problem is initially described, the nozzle is located on the left bottom side of the tank with the nozzle exit facing downward. if this is the case, there will be no horizontal force to act as a thrust to start the tank in a horizontal motion.  Any thrust that may be developed by the water exiting the nozzle will be in the opposite direction of the jetting water. That is, in a vertical upward direction.
Now if the nozzle exit was directed to the left or right of the tank in a horizontal direction,  the exiting water will surly develop thrust to move the tank along the rail tracks.  the amount of thrust created will be a function of the flow rate and nozzle size.  the maximum head of water will not be greater than the height of the water in the tank. the fact that inside the tank the water travels internally in the left direction will create no external force to move the tank. any force applied for horizontal motion must be external.
