The pressure gradient of the high confinement pedestal region at the edge of tokamak plasmas rapidly collapses during plasma eruptions called edge localised modes (ELMs), and then re-builds over a longer time scale before the next ELM. The physics that controls the evolution of the JET pedestal between ELMs is analysed for 1.4 MA, 1.7 T, low triangularity, delta = 0.2, discharges with the ITER-like wall, finding that the pressure gradient typically tracks the ideal magneto-hydrodynamic ballooning limit, consistent with a role for the kinetic ballooning mode. Furthermore, the pedestal width is often influenced by the region of plasma that has second stability access to the ballooning mode, which can explain its sometimes complex evolution between ELMs. A local gyrokinetic analysis of a second stable flux surface reveals stability to kinetic ballooning modes; global effects are expected to provide a destabilising mechanism and need to be retained in such second stable situations. As well as an electronscale electron temperature gradient mode, ion scale instabilities associated with this flux surface include an electro-magnetic trapped electron branch and two electrostatic branches propagating in the ion direction, one with high radial wavenumber. In these second stability situations, the ELM is triggered by a peeling-ballooning mode; otherwise the pedestal is somewhat below the peeling-ballooning mode marginal stability boundary at ELM onset. In this latter situation, there is evidence that higher frequency ELMs are paced by an oscillation in the plasma, causing a crash in the pedestal before the peeling-ballooning boundary is reached. A model is proposed in which the oscillation is associated with hot plasma filaments that are pushed out towards the plasma edge by a ballooning mode, draining their free energy into the cooler plasma there, and then relaxing back to repeat the process. The results suggest that avoiding the oscillation and maximising the region of plasma that has second stability access will lead to the highest pedestal heights and, therefore, best confinement-a key result for optimising the fusion performance of JET and future tokamaks, such as ITER.