Bard and Faulkner are outstanding electrochemists, but that potentiostat figure always annoys me because it makes it seem as though current flows through the reference electrode and that the working electrode is literally grounded. In reality, the reference electrode should conduct extremely low currents (pA, really) and the current through the working electrode is what you care about, as a function of the electroactive species in th potentiostat's solution.
Therefore, consider Fig. 15.24 and surrounding text from from Horowitz and Hill 1:

In this three wire potentiostat, the bottom operational amplifier (op amp) simply works as a transimpedance amplifier, converting current at the working electrode to voltage. In this regard, it is basically a very low input impedance ammeter, which approximates an ideal ammeter. So the working electrode is held at virtual ground, which typically means less than a millivolt from true ground.
The potential at the inverting input of the upper op amp must equal the input reference voltage, $\mathrm V_{ref}$, to within less than a millivolt. Note that $\mathrm V_{ref}$ can be from a ramp generator, a function generator or from another op amp, as in the inverting summing op amp in the figure from Bard and Faulkner. Importantly, note that virually no current flows through the reference electrode, because of the extremely high input impedance of the op amp inputs, so it will function properly and not become polarized or damaged.
The potential between the working and reference electrodes is $\mathrm V_{ref}$ because the working electrode is clamped to virtual ground and the potential of the reference electrode is clamped at $\mathrm V_{ref}$. The solution in the cell has an impedance, which is generally complex, and the solution spans the volume between the counter electrode (also called the auxilliary electrode) and the working electrode. The reference electrode is physically placed as close to the working electrode as is feasible.
Now let $\mathrm Z_{c}$ denote the solution impedance between the counter and reference electrodes and let $\mathrm Z_{u}$ denote the solution impedance between the reference and working electrodes. Then we have a non-inverting voltage follower with gain, as shown is this figure:

The output voltage, $\mathrm V_{o}$, is the voltage at the counter electrode. Therefore, $$\mathrm V_{o} = [(Z_{c} + Z_{u})/Z_{u}] \times V_{ref} \tag{1}$$
But the voltage at the junction of $\mathrm Z_{c}$ and $\mathrm Z_{u}$ , i.e., in the solution where the reference electrode is located, is $\mathrm V_{ref}$. Therefore $$\mathrm V_{ref} = [Z_{u}/(Z_{c} + Z_{u})] \times V_{o} \tag{2}$$
If solution impedances change, the upper op amp will source or sink current, as necessary, by changing $\mathrm V_{o}$, thereby maintaining the solution potential, at the reference electrode, equal to $\mathrm V_{ref}$.
1 P. Horowitz, W. Hill, The Art of Electronics, 2nd Ed., Cambridge University Press, Cambridge, ©1989, pp. 1015-1016.