Beethoven's piano sonata in C Major Op. 53
The roman numerals for measures 79-83 in E minor are:
iv V/iv iv ii065 i64 V i II i64 V7
For measures 84-87 (first ending) in C major
I ii6 I64 vii06 I I II
and for measures 86-90 (seond ending) in d minor
v iv III64 vii7 i VI III vii7 i
He used a melodic sequence in measures 80-81, c a f#, b g e, a f# d#, e.
Here he was just arpeggiating chords of e minor, which helps establish that key. He elaborated on this melodic idea in the following measures, adding a scalar figure with the same rhythm. The first of these ends on a nice e again, but in preparing for the modulation Beethoven changes the second so that it is spelling out C major chords and it ends predictably in C major. For the two measures of the first ending Beethoven emphasizes the key change by playing repeated C major chords, but surprisingly in the last beat plays a D major chord. This matches exactly the two measure introduction to the piece.
The second ending begins with a C major chord again, but this time only for a beat so that the transition to d minor can be established. One way that he shows this new key is in the bass line, which has a rising and slowing progression to the D in measure 88. He also uses that same arpeggiating sequence in the melody, this time using D minor chords, to establish the key. Finally in measures 90 and 91 the D minor chord is played as the C major chord was at the very beginning and the first ending, firmly landing the listener in the neopolitan key.