The very same sharp/flat tones can be written in two ways:
- C♯ is the same as D♭
- D♯ is the same as E♭
- …and so on
This is so confusing. What is the reason for it? Wouldn't it be easier to use only X♯ or only X♭?
The equivalences you mention---C♯/D♭, D♯/E♭, etc.---aren't actually the same note. They're called enharmonically equivalent pairs, but only in Equal Temperament are they tuned to the same frequency. See this question for more information on why they're not the same note.
As for why we need flatted notes at all, let's look at the how major scales are put together. We need to agree on these things:
With these two principles in mind, let's build an F Major scale:
We start with F. A whole note up and we get to G. Another whole note, and we have A. Now the first half-step. What is this note? It can't be an A♯, because we've already used A. It can't be a B♮, because B is a whole step up from A. It has to be some kind of B, but a half-step lower than B♮. And so: B♭.
Now that we've invented B♭, let's create the B♭ Major scale: B♭, C, D,... uh-oh. Guess we need an E♭. And when we create the E♭ Major scale, we'll have to create an A♭, etc. etc.
Of course this same idea justifies the existence of sharped notes as well. Create the G Major scale, and when you get to the seventh note you find that you've used up all the letters except F, yet you need a note a whole step up from E (or, if you like, a half step down from G). And so you're forced to create F♯.
One could ask why it is that the interval from E to F need be a half step. If E to F were a whole step and F to G a half step, then we wouldn't need an F♯ to make the G Major scale. This is true, but it's also robbing Peter to pay Paul: then the D Major scale would still require a C♯, while the C Major scale would now require an F♭.
C# is not the same as Db any more than the English word "hear" is the same word as "here".
Understanding why there is a difference is an important foundation to Western melody and harmony. It's important to understand the following:
So, imagine you're in the key of A major. The diatonic notes are: A B C♯ D E F♯ G♯. What does C♯ mean? It means the third note of the scale. What does D♭ mean? It means you've taken the fourth note of the scale and lowered it it.
In 12-tone equal temperament, they may sound the same; you may play them the same on the piano or the guitar. But if the function of the note at a particular point in the piece is as the third note in the A major scale, you can only write it C♯ and not D♭. C♯ means something completely different.
In non-12-et tunings, they won't even sound the same.
The flats and sharps came about separately as modulations toward the subdominant and the dominant, respectively. The subdominant is more important in older western music and church music. The dominant modulation was a more recent development.
So going from C to F is a modulation toward the subdominant. To modify the lydian mode (C scale starting on F, w-w-w-h-w-w-h) into the Ionian mode (F scale starting on F, w-w-h-w-w-w-h) means the fourth (B) has to be flattened (B♭).
To go from C to G is a modulation toward the dominant. To modify the myxolydian mode (C scale starting on G, w-w-h-w-w-h-w) into the Ionian mode (G scale starting on G, w-w-h-w-w-w-h) means the seventh (F) has to be raised (F♯).
Additional sharps and flats in the key signature represent further deviations from the C-Major scale; but always they are patching the fours and sevens to realign the modes.
Because they are not really the same, only in equal temperament tuning they are. Look here: http://en.wikipedia.org/wiki/Enharmonic.
Another example of an instrument where the distinction between enharmonic notes is important is a handbell choir. A typical three-octave handbell choir will have eleven people. Starting with the C below middle C, the first performer will play C and C# with the left hand, and Db, D, and D# with the right. The second performer will play Eb and E with the left hand; F and F# with the right. The third performer will take Gb, G, and G# with the left; Ab and A with the right, etc.
If part of a piece is in Eb major and part is in E major, the D#/Eb chime would be played by the second performer's left hand when it was used as an Eb, and by the first performer's right hand when it was used as a D#. The same bell is used for both D# and Eb, but who plays it depends upon which note is used for it. While there are occasions when that pattern doesn't work out optimally, in most cases it works out well since a D# is more likely to be played near an E natural than a D natural, but an Eb is more likely to be played near a D natural than by an E natural.