Why are the intermediate states not the equilibrium states in $S-U$ plot during a spontaneous process? We are given an isolated system which is composed of two subsystems $A$ and $B$. The fundamental equation of entropy of both the systems are given as
$$S=c(NVU)^{1/3}$$
where $c$ is a constant whose value is taken to be 1.
The two subsystems are joined by a wall which is adiabatic, not movable and impermeable.
$V_A=9\times10^{-6}m^3,\;\;V_B=4\times10^{-6}m^3$
$N_A=3\;moles,\;\;N_B=2\;moles$
Total energy of composite system is $80J$.
Now if the wall is made diathermal and the system is allowed to come in equilibrium, then find the internal energies of each of the subsystems?
We can see that $S_{Total}= (0.03(U_{fA})^{1/3})+(0.02(80-U_{fA})^{1/3})$
So we have to find the value of $U$ s.t. $S_{Total}$ maximizes.
It comes out that the final internal energy of $A$ is $51.80J$.
I have also made the plot of the above situation in python to visualize it.

Red point corresponds to the state in which entropy maximizes for the composite system.
Suppose that when the internal walls separating A and B was adiabatic, the internal energy of $A$ is $5J$, Then the corresponding point in total entropy vs internal energy of A is as shown in the green colour.
The Clausius inequality says that $dS\geq\int\frac{dq}{T}\tag{1}$.
As our composite system is isolated, so there is no heat exchange thus $dq=0$.
So, $(1)$ becomes, $dS\geq 0\tag{2}$
So, this suggest that any spontaneous process which occurs inside this composite system(heat exchange between $A$ and $B$ as walls are diathermal), increases the entropy.
I have a question that why the equilibrium state corresponds to maximum entropy not any entropy which is greater than the initial one but not maximum? As we can see that $(2)$ suggests that in this process entropy increases but does not say anything that the equilibrium state which the system A and B achieves corresponds to the maximum entropy of the composite system.
Why the equilibrium state does not correspond to the any point between green and red? Why it corresponds to only red point, in the above process?
So, basically, why are the intermediate states not the equilibrium states in $S-U$ plot during a spontaneous process?
 A: The essence of your question is why the statement that equilibrium state corresponds to maximum entropy is equivalent to the thermodynamic inequality $\Delta S \geq 0$ for an isolated system?
More than on mathematical manipulations, the answer depends on a conceptual understanding of the meaning of $\Delta S \geq 0$, and thermodynamic equilibrium.
Let me start with the latter. A thermodynamic system is made by a huge number of dynamically evolving microscopic degrees of freedom. Within thermodynamics, we are not interested in the details of what these microscopic degrees of freedom are or their dynamics. What really matters is that a thermodynamic system, sooner or later, will access all the microscopic states compatible with its global constraints. Notice that sooner or later in some cases may even mean times much larger than any reasonable observable time. This has to do with the concept of metastable equilibrium states. For the sake of simplicity, let's ignore this possibility. It does not modify in a significant way the main argument.
Thermodynamic equilibrium is the asymptotic macroscopic state of a thermodynamic system, characterized by a stationary value of all the macroscopic observables over the whole volume occupied by the system.
Notice that such a macroscopic stationary state does not implies that the underlying microscopic dynamics has stopped.
What about the condition $\Delta S \geq 0$? Entropy is a state function, and then it is defined for every macroscopic equilibrium state. If we have a macroscopic system made by macroscopic parts, we can treat each subsystem as a thermodynamic system, provided enough time is allowed to equilibrate. For the usual systems of interest in thermodynamics, we have the additivity of the energy (the energy of the whole system is the sum of the energies of the subsystem ($U=\sum_i U_i$), and entropy is the sum of the corresponding entropies ($S=\sum_i S_i$).
The condition $\Delta S \geq 0$, for an isolated system $\Sigma$, is a condition on the whole thermodynamic system characterized by the entropy $S$ at fixed values of its variables, characterizing the whole system $\Sigma$. For instance, if we are dealing with a simple system characterized by the values of energy $U$, volume $V$, and number of moles $n$, such variables are fixed and the variation $\Delta S$ should be intended as a function of any variable describing internal changes, at fixed $U, V,$ and $n$.
If there is no internal change, the system is at equilibrium by definition.
Now let's put all these pieces together. If we have a system made by two subsystems like in the example of the question, a fixed  $U, V,$ and $n$, the entropy of the total system depends on the energy of subsystem $1$, $U_1$. The energy of subsystem $2$ is not an independent variable, due to the global constraint $U=U_1+U_2$. If we have the constraint of no exchange of energy between subsystem $1$ and $2$, there is nothing that may change, and the entropy $S=S_1+S_2$ will remain at its value forever ($\Delta S = 0$). The system is at equilibrium.
However, as soon as we eliminate the constraint on a fixed value of $U_1$, the never-ending microscopic dynamics will allow changes of the original value $U_1$. Clausius' inequality says that the only observed macroscopic states are those such $\Delta S \geq 0$. If the entropy was at a maximum with respect to $U_1$, $\Delta S=0$ and no change will result: the system remains at equilibrium. If there are values of $U_1$ with a larger entropy, we have irreversibility: as soon subsystem $1$ gets a  macroscopic state with energy $U_1^*$ such that $S(U_1^*)\geq S(U_1)$ is reached, the original state at $U_1$ is not reachable anymore. Since there is no constraint on $U_1$, the process must go on, reaching states of higher and higher total entropy, just because there is no constraint on $U_1$. However the increase of entropy must stop somewhere, either because $U_1$ has a finite interval of variation, or because, at some $\hat U_1$, $\Delta S(\hat U_1)=0$.
In both cases, the possibility of change stops at a maximum of the entropy as a function of the constraint variable $U_1$. But stopping the possibility of changes means getting a macroscopic stationary state, i.e. thermodynamic equilibrium.
To summarize, the brief form of the answer is that the equilibrium state cannot be a state different from the maximum of the entropy because in such a case the system cannot remain there forever. Sooner or later, it will find its way towards a state with higher entropy.
A: The equation $\Delta S>0$ applies to the initial and final thermodynamic equilibrium states of the system.  In what you are describing, the intermediate states of the system are not thermodynamic equilibrium states.
A: I add an "edit" since it was too long for a comment. And sorry for my poor english. Is is not my native language.
Even if one can understand his ideas within the framework of statistical physics, classical thermodynamics is an axiomatic science: one must consider his postulates as true at the outset.
The question you are asking is whether we can justify the principle of maximum entropy from the old statements of Clausius or Kelvin. I'm not sure of it ! Unless we add to the formulations of Kelvin or Clausius that if an evolution which increases entropy is possible, thermodynamic equilibrium is not reached. This is probably why the "modern" formulations of the second principle postulate the principle of maximum entropy and no longer use the statements of Kelvin or Clausius.
It seems to me that the argument given by @GiorgioP "the never-ending microscopic dynamics will allow changes of the original value" calls on statistical physics and therefore goes beyond the framework of pure classical thermdynamics ?
If you look at W Gibbs' seminal article: "equilibirum of hetergeneous substance" (1878):
He begins by quoting in the head the famous commentary of Clausius of 1865 (already a formulation by extremum):
“The energy of the universe is constant.
The entropy of the universe tends to a maximum."
And he postulates:
CRITERIA OF EQUILIBRIUM AND STABILITY.
The criterion of equilibrium for a material system which is isolated from all external influences may be expressed in either of the following entirely equivalent forms :
I. For the equilibrium of any isolated system it is necessary and sufficient that in all possible variations of the state of the system which do not alter its energy, the variation of its entropy shall either vanish or be negative. If $ε$ denote the energy, and $η$ the entropy of the system, and we use a subscript letter after a variation to indicate a quantity of which the value is not to be varied, the condition of equilibrium may be written ${(\delta\eta)}_\varepsilon\le0$
Using only the Clausius inequality, I think your formulation of the second principle is incomplete. If you take, for example, Callen's book “Thermodynamics and an introduction to thermostatistics”, (p 27 of the second edition):
Postulat II : there exist a function (called the entropy S) of the extensive parameters of any composite systems, defined for all equilibrium states and having the following properties : the value assumed by the extensive parameters in the absence of an internal constraint are those who maximize the entropy over the manifold of constrained equilibrium states.
And in a more recent book : “an introduction to statistical mechanics and thermodynamics” (Swendsen, p 104) : you have the same formulation :
Postulate 2: entropy maximization
Postulate 2 : the value assumed by the extensive parameters of an isolated composite system in the absence of internal constraints are those who maximize the entropy over the set all constrained macroscopic states.
A: I understand the equilibrium states as the most likely ones. Having in mind that "most likely" on macroscopic systems means that is nearly impossible to see the system on a state that is different from the equilibrium one.
Rephrasing: I guess that those intermidiete states are possible states, in the sense that the real system could have a very rare fluctuation and "visit" them.
