On thermodynamics of spontaneity of the reduction-oxidation chemical reactions According to the first and second law for a closed system containing different chemicals we have
\begin{align}
&\delta Q - \delta W = dU = T dS - p dV +\sum_i \mu_i d N_i\\
&\Rightarrow\;\delta W - p dV + \sum_i \mu_i dN_i = \delta Q - T d S \le 0\qquad\because\text{2nd law}\\
&\Rightarrow\;\delta W - p dV + dG\bigr|_{p,T} \le 0\\
&\Rightarrow\;\delta W - p dV \le -dG\bigr|_{p,T}\\
\end{align}
If $\delta W = p dV$ then $dG\bigr|_{p,T}\le 0$, that is, the condition $dG\bigr|_{p,T}\le 0$ coincides with the second law only if the only work done by the system is the pressure work and no other kind.
In addition, if $\delta W = p dV + \text{``other works"}$, then $\text{``other works"}\le -dG\bigr|_{p,T}$. This means the change in the "minus Gibbs function" is the maximum work attainable from the system beside the pressure work. This extra work can be positive or negative, in the form of electric work, friction work etc.
Therefore, it is clear that:


*

*A system cannot at the same be derived by $dG\bigr|_{p,T}\le 0$ and does e.g. an electric work $\delta W_{Electric}$;

*If the system does have a $\delta W_{Electric}$ then its maximum value would be equal to $dG\bigr|_{p,T}$ but if so, then the process is already assumed reversible and all the inequalities should be substituted by equalities.
However, according to this Mc Graw-Hill link during a spontaneous reduction-oxidation chemical reaction the Gibbs Free Enthalpy must decrease and at the same time the change in the Gibbs Free Enthalpy is the maximum electric work that the reaction can do:
$$\Delta G = W_{max}\le 0$$ 
I cannot understand this and have a number of problems with this derivation:


*

*First of all, the maximum work that a system can do on its surrounding equals minus the change of the Gibbs Free Enthalpy, so the equality $\Delta G = W_{max}$ doesn't hold?

*If the work has attained its maximum value, then the process must be assumed as reversible, but the inequality in the formula above holds for irreversible processes!

*If there is an Electric work done by the system then decreasing Gibbs free energy is no longer necessary due to the second law?

*When both the donor and acceptor of electron in the chemical reaction lay inside the system the electric work will nowhere enter the formulation as the electric work is an internal work that does not crosses the boundary of the system!? But the whole formulation is here to study $W_{electric}$ in the system as spontaneity of the reaction should be related to the electromotive force of the reaction which has a chance to appear in $W_{electric}$ only! So what should be taken as system here?
Hint. In the books on thermodynamics that I have seen that discuss the electric works they are usually dealing with the problem of Electrochemical cells. But electrochemical cells work in an outer electric circuit and so if one assume the cell as the closed system yet the electric work will enter the discussion. Only one book was talking about open-circuit Emf but again I have the problems listed above with that as well.
[I have asked the same question at the Chemistry.SE here but have not been convinced with the single answer given there.]
 A: The material contained in the given link suffers from mistakes such as:


*

*For a process carried out at constant temperature and pressure, the Gibbs free
energy change is equal to the maximum amount of work (wmax) that can be done by
the process.

*$G° = –nF$.

Coming to answer your questions, the second equality in your equations: 
δQ−δW = δQ−(pdV + other forms of work output) = dU for an arbitrary process (1st law)
δQrev−δWrev = δQrev−δWmax = (pdV + other forms of work output)max= dU for a reversible process (1st law)
δQrev = TdS 2nd law
Combination of 1st and 2nd laws gives for a reversible process the equality sign and the inequality sign for an irreversible process.
$$δQ−δW=dU=TdS−pdV+∑_i μ_i \mathrm{d}N_i $$
applies only to reversible processes, since you have substituted δQ = TdS, which applies only for reversible processes. Consequently, your next step must read as:
$$ ⇒δW−p\mathrm{d}V+∑_i μ_i \mathrm{d}N_i=δQ−T\mathrm{d}S=0 $$       ∵2nd law
and not as:
$$⇒δW−p\mathrm{d}V+∑_i μ_i \mathrm{d}N_i=δQ−T\mathrm{d}S ≤ 0 $$      ∵2nd law
This leads to the last step with equality sign
$$⇒δW−p\mathrm{d}V=−\mathrm{d}G\bigr|_{p,T}$$
This equation says, the decrease in free energy of a system (redox reaction) corresponds to the maximum work that the system can provide other than pressure-volume (pdV) work.
The statement in the link:
For a process carried out at constant temperature and pressure, the Gibbs free energy change is equal to the maximum amount of work ($W_{max}$) that can be done by the process. $ΔG=W_{max}$, is not correct.
This must suffice as the answer for your first 3 points.
For your 4th point:
When both the donor and acceptor of electron in the chemical reaction lay inside the system the electric work will nowhere enter the formulation as the electric work is an internal work that does not crosses the boundary of the system!? But the whole formulation is here to study Welectric in the system as spontaneity of the reaction should be related to the electromotive force of the reaction which has a chance to appear in Welectric only! So what should be taken as system here?
You can very well have the electrons getting transfered from the donor to the acceptor within the system. In such a case, you will be studying a corrosion reaction and the free energy will be liberated as heat and gets tranfered to the heat reservoir that maintains the system at constant temperature.
But when you want to study the process under reversible conditions (open circuit emf you take leads outside the cell.
When you take the electric leads out and connect your load, the electrons don't get tranfered from the donor to the acceptor directly, but, liberated from the donor, they pass through the external circuit and then reach the acceptor - while the ion transfers within the cell do the job of transporting the electric charge, thereby maintaing the continuity of passage of electricity though the cell.
If you have more questions or if your questions are not answered completely, you may seek clarifications and I will be happy to answer to the best of my knowledge.
