I'm aware why E and B sharp don't exist but apparently they exist in music theory because of functional differences that may occur. If they don't exist on instruments, why do they exist in theory? Why can't I just mess around F instead of E#?
I'm aware why E and B sharp don't exist...
Of course they exist.
For tonics of
C# the leading tones are
B#. If you want to see examples of those tonics with their leading tones, without the mess of enharmonic keys like
C# major, just look at the minor keys:
F# minor and
There is something called a theoretical key which is the kind of purely theoretical thing that I think you had in mind.
Why do such things exist in theory? I suppose the answer is because you can infinitely transpose (like transposing up/down a perfect fifth) and if you do that you eventually get into double, triple, etc. sharps/flats and enharmonic equivalents.
If you meant to ask about theoretical keys of
E sharp major and
B sharp major, you should make that clear.
E♯ is a pitch.
E♯ major is still ambiguous. It could mean a chord or key. "Key of
E# major" is clear.
For simplicity of writing in any key, each of the 7 notes diatonic to that key is deigned to have a separate letter name - chosen from A B C D E F and G.
That in itself necessitates there being E♯ in C♯ key, and B♯ in C♯ key also. (Not forgetting F♭ and C♭ in another key). At least that way, written music will have each line and each space dedicated to a specific letter name.
There's also the fact that certain chords, to be written properly, need to be as such. Take, for example, the chord of E+ (E augmented). It has the 5th sharpened. Standard E comprises E G♯B. So E+ will have to be E G♯ B♯. Writing it as E G♯ C is plain wrong!
All this presumes 12tet - as other tuning systems (temperaments) will actually have B♯ and C as (slightly) different pitches.
They exist because the spelling of notes matter. One very simple example is a C major chord consist of the notes C, E, G. All a 3rd apart as that's how chords are spelled. When you build a C♯ major chord you then have C♯, E♯, G♯.
I'd also like to point out things like double sharps and flats that extend the range of notes even more so something like D♭♭ would be equivalent to a C, it's spelled that way for a reason.
The fact that they have functional differences is exactly why they exist in theory. The purpose of theory is to describe why "F" functions differently in C# major than it does in C major.
Historically it is also the case that notes like C# and Db were actually two different pitches, thus the distinction existed before the theory came about.
They exist because ANY note can be sharpened or flatted (flattened?), even if there is no accidental note between them. The most fundamental example is if you have studied the cycle of 5ths you will know that when you get to 7 sharps (C#) or 7 flats (Cb) every note is either sharp or flat. The key of F#, or 6 sharps contains an E# and Gb, or 6 flats contains a Cb. This is necessary because keys must contain every letter with no repetitions in their makeup, you can not have one letter repeated even if they are different notes, for example F to F# must be E# to F#.
Well for me E#, B#, etc exist both in theory and practice, and they can be very useful as well.
I'm a string player, and I find it very useful, when I'm in the middle of some sequence of modulations, to get this kind of (partial) cue or reminder, about what part my coming note is playing in the harmony. It can furnish a cue about suitable adjustment or 'bending' of the pitch either up or down.
Of course it's only a partial cue, it doesn't tell the whole story about the upcoming harmony, but it's a useful part of the tradition that I wouldn't like to see eliminated.