Why can Bernoulli's equation be applied along two different streamlines for an irrotational flow? The following is written in Physics by Halliday, Resnick and Krane (5th ed.). 

$$p + \frac{1}{2} \rho v^2 + \rho g y = \mathrm{constant}$$
Strictly speaking, the points to which we apply Bernoulli's equation should be along the same streamline. However, if the flow is irrotational, the value of the constant is same for all the streamlines in the tube of flow, so Bernoulli's equation can be applied to any two points in the flow.

Here, $p$ is the pressure of the fluid at a point, $\rho$ is the density(assumed constant), $v$ is the velocity of the fluid element, and $y$ is the vertical distance of the element from a fixed reference point. From point to point, $p$, $v$ and $y$ will change.
How can one prove that the constant in Bernoulli's equation does not change along two streamlines for irrotational flow?
The fluid can be assumed to be non-viscous, incompressible and the flow is steady.
 A: This answer is taken from The Feynman Lectures on Physics, Vol. II, Ch. 40: The Flow of Dry Water, Section 40-3: Steady flow—Bernoulli’s theorem.
Imagine a bundle of adjacent streamlines which form a stream tube as sketched in the figure.

From equation of continuity, we can write that $A_1 v_1 = A_2 v_2$. Density of the fluid is constant. Now we calculate the work done by the fluid pressure. The work done on the fluid entering at $A_1$ is $p_1 A_1 v_1 \Delta t$ and the work given up at $A_2$ is $p_2 A_2 v_2 \Delta t$. The net work on the fluid between $A_1$ and $A_2$, is therefore
$$p_1 A_1 v_1 \Delta t - p_2 A_2 v_2 \Delta t \tag1$$
which must equal the increase in the energy of a mass $\Delta M$ of fluid in going from $A_1$ to $A_2$. In other words,
$$p_1 A_1 v_1 \Delta t - p_2 A_2 v_2 \Delta t = \Delta M (E_2 - E_1) \tag2$$
where $E_1$ is the energy per unit mass of fluid at $A_1$, and $E_2$ is the energy per unit mass at $A_2$. The energy per unit mass of the fluid can be written as
$$E = \frac{1}{2}v^2 + \phi + U,$$
where   $\frac{1}{2}v^2$ is the kinetic energy per unit mass, $\phi$ is the potential energy per unit mass, and $U$ is an additional term which represents the internal energy per unit mass of fluid. The internal energy might correspond, for example, to the thermal energy in a compressible fluid, or to chemical energy. All these quantities can vary from point to point.
Now, I think that this internal energy can also include the net rotational energy of the individual molecules. So, if the fluid is irrotational, then the contribution of the rotational motion of the individual particles will become zero. If the flow is rotational, we cannot guarantee that the rotational energy of the molecules per unit mass is same everywhere.
Using this form for the energies in $(2)$, we have
$$\frac{p_1 v_1 A_1 \Delta t}{\Delta M} - \frac{p_2 v_2 A_2 \Delta t}{\Delta M} = \frac{1}{2}v_2^2 + \phi_2 + U_2 - \frac{1}{2}v_1^2 + \phi_1 + U_1$$
But $\Delta M = \rho A v \Delta t$, so we get
$$\frac{p_1}{\rho} + \frac{1}{2}v_1^2 + \phi_1 + U_1 = \frac{p_2}{\rho} + \frac{1}{2}v_2^2 + \phi_1 + U_2,$$
which is the Bernoulli result with an additional term for the internal energy. If the fluid is incompressible and irrotational, the internal energy term is the same on both sides, and we get again that $$p + \frac{1}{2}\rho v^2 + \rho g y$$ holds along any streamline.
A: Some preliminaries
The question you are asking must absolutely necessarily be answered in more than one dimension. This is because a one-dimensional flow will always be irrotational and will be characterized by a single streamline. So I am going to describe the problem in the 2 spatial dimensions $x,y$. Then, we will have vectors such as the velocity $\vec{v} = (v_x, v_y)$.
Irrotational flow
I will also have to use the partial derivative, a derivative with respect to just one variable while the rest is being kept constant. The condition of an irrotational flow is then given as
$$\frac{\partial v_x}{\partial y} = \frac{\partial v_y}{\partial x}$$
When you go into vector calculus, you will see that when this condition is violated, the velocity field creates a small vortex. So the irrotational condition asks that no such vortices are not present in the flow. 
Lagrangian derivative
Now let's take a look at the concept of a Lagrangian derivative $D/dt$. This derivative is asking what happens to a quantity in time if I follow it as it is being dragged by the streamlines. For instance, you may have a stationary flow where at every fixed point in space the variables see no changes, but if you follow the streamline, the element is sped up, slowed down, pressurized, depressurized... This is exactly the case where the partial derivative of any variable with respect to the time $t$ will be zero, but the Lagrangian derivative will be nonzero. 
We will be talking only about stationary flows, and in that case the Lagrangian derivative of any quantity $q$ is simply defined as
$$\frac{D q}{dt} = \frac{\partial q}{\partial x} v_x + \frac{\partial q}{\partial y} v_y$$
If you would ever like to learn vector calculus, the expression above is just equivalent to the projection of the gradient of $q$ in the direction of $\vec{v}$, $Dq/dt = \vec{\nabla}q \cdot \vec{v}$.

Conservation of Bernoulli integral along streamlines
So the Bernoulli integral for an incompressible inviscid fluid in a homogeneous gravitational field accelerating in the $-y$ direction is defined as
$$B = \frac{1}{2} \rho (v_x^2 + v_y^2) + p + \rho g y$$
Now we assume a stationary flow, and write down the Euler equations for it
$$\frac{D v_x}{dt} = - \frac{p_{,x}}{\rho}$$
$$\frac{D v_y}{dt} = - \frac{p_{,y}}{\rho} - g$$
You should know these equations as telling you what acceleration does a fluid element experience when moving through specific pressure gradients and gravitational accelerations. 
Now let us take both the Euler equations and 1) move all the terms to the left hand side, 2) multiply the $x$-equation by $\rho v_x$ and the $y$-equation by $\rho v_y$, and 3) add them together. What you get is
$$\rho (v_x \frac{D v_x}{dt} + v_y \frac{D v_y}{dt}) + (\frac{\partial p}{\partial x} v_x + \frac{\partial p}{\partial y} v_y) + \rho g v_y = 0$$
We can rewrite this a little bit more by noticing that the terms involving $p$ are just equal to $Dp/dt$, and also by realizing by direct computation that we can write $v_y = D y/dt$. We then get
$$\rho (v_x \frac{D v_x}{dt} + v_y \frac{D v_y}{dt}) + \frac{Dp}{dt} + \rho g \frac{D y}{dt} = 0$$
Let us now ask what happens if we take a Lagrangian derivative of $B$
$$\frac{DB}{dt} = \rho (v_x \frac{D v_x}{dt} + v_y \frac{D v_y}{dt}) + \frac{Dp}{dt} + \rho g \frac{D y}{dt}$$
But we see that this is something which we have just proven to be zero out of the Euler equations! That is, we get that as long as Euler equations are fulfilled and as long as the fluid is stationary, we have
$$\frac{D B}{dt} = 0$$
But notice that this proof only tells us about the derivative of $B$ along the streamline!! I.e., one can have a slightly different $B$ constant along every different streamline and it is in no conflict with the streamline-conservation of $B$. 

Bernoulli integral in irrotational flows
Let us assume we have a stationary irrotational flow. Now, the Bernouli function will be constant if its derivative along any spatial direction vanishes 
$$\frac{\partial B}{\partial z} = 0\,, \,z=x,y$$
Let's first make a derivative with respect to $x$
$$\frac{\partial B}{\partial x} = \rho (v_x \frac{\partial v_x}{\partial x} + v_y \frac{\partial v_y}{\partial x}) + \frac{\partial p}{\partial x} $$
Now we use the irrotational condition $\partial v_y/\partial x = \partial v_x/\partial y$ and we obtain
$$\frac{\partial B}{\partial x} = \rho (v_x \frac{\partial v_x}{\partial x} + v_y \frac{\partial v_x}{\partial y}) + \frac{\partial p}{\partial x}  = \rho \frac{D v_x}{dt} + \frac{\partial p}{\partial x} = 0$$
where the second equality holds because of the $x$ Euler equation. In a completely  analogous way we use the irrotational condition in the $y$ case and we get
$$\frac{\partial B}{\partial y} = \rho \frac{D v_y}{dt} + \frac{\partial p}{\partial y} + \rho g =0$$
where now the second equation holds because of the $y$ Euler equation.
In summary, stationary irrotational flows have a constant value of the Bernoulli integral all around the flow. This is hard to grasp by physical intuition, but it might be easier to think about it the other way around; for a stationary flow to be irrotational, it must necessarily even out the value of the Bernoulli integral throughout the flow. 
