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.