Enharmonics are notes that are the same pitch but are known by two different names, for instance C# and Db. These are the black notes on the piano. The white keys on the piano are known as the natural notes, such as C, D, E, F, G, A, and B. These are also the notes of the C Major scale. However, other keys signatures will sharp or flat these notes to fit the scale. However, the key signature is not the only thing that determines if a note is called sharp of flat. A composer may sharp or flat a natural note for a certain effect. Or, often a composer will depart from the key signature and need to add (or subtract) sharps and flats. For instance, though C# and Db are the same note, accepted musical notation dictates that in the key of A major this note is written C#, and in the key of Ab major it is written Db.
The key signature of a piece of music tells you which notes are sharp and flat. However, that does not mean that the song must always stay in that key. Many times a song will change key but the key signature will stay the same. When this happens you'll see sharp and/or flat signs in front of notes.
This same passage would look like this if the key signature was Ab instead of D.
These examples are showing two things at the same time.
1) The key signature does not always tell you what key the music is in.
2) The same pitch can be noted differently.
The main thing to remember is that musical pitches we call notes can go by more than one name. We spell those names with letters and symbols. There can be some odd spellings but don't let that throw you. The oddest spellings, I think, are the ones that involve double flats and double sharps. Below is an example of some odd enharmonic equivalent notes that you will encounter.
Of course, any note can be spelled a number of ways. What spelling is used depends on its usage. Luckily, some spellings are more common than others and you'll know right away what the pitch of the note is. Below is a list of the common spellings and their enharmonic equivalents.