I have listened to the Hammerklavier Sonata many times, sometimes while following the score, and I have noticed that, in the second movement, there is a change in the key signature for just a little. This has baffled me for quite some time.
I checked different editions of the score available on IMSLP, and all of them contain this change.
I am referring to the change that happens when the tempo changes to Presto in the image below.
From what I can tell, the music modulates from Bb major to B minor. Then the key signature changes to C major/A minor, only to go back to the 2-flat key signature.
IF I was the composer, I'd change the key signature to B minor in the third bar of the image, use A-sharp instead of B-flat, and then I'd change the key signature back to Bb major in the Tempo I mark.
Is there any special reason why Beethoven wrote it like this?