I'm not sure if this has been covered allready, but I think it is worth mentioning. For selecting notes that fit together, use a scale:
1) C Major - use only the white keys on the keyboard/piano
You can make a melody with any of those notes, however the last one should be a C.
Chords that accompany this are C,F and G7. C=CEG, F=FAC and G7=GBD(F)
2) Pentatonic - use only the black keys on the keyboard
This makes the melody sound a bit Chinese.
3) Jazz - use these notes: C, D#, F, F#, G, A#
4) Blues - use these notes: C, D, D#, E, G, A
5) minor: C,D,D#,F,G,G#,A# (minor is used to make a sad melody.)
A standard setting for music is:
1) drum
2) bass
3) chords
4) melody
Start with the chords, add a melody, then a bass and finally drums.
Play the chords in a low octave, and the melody in the high octave.
One or two octaves below the chord octave, play the bass. This is usually the first note of a chord, or a simple tune.
If you are writing pop music, use this scheme:
1) verse
2) chorus
3) verse
4) chorus
5) bridge/break
6) chorus
7) chorus
I believe that a good ear for music is natural. Musical theory is based on existing music. A lot of famous musicians don't/didn't know how to read notes. For instance Paul McCartney and Lionel Richie. I saw that on TV two weeks ago.
Here is a great book from the KLF. They describe how to write a hit record:
http://www.instrumentality.com/themanual.html(Hmm, parts of the text seem to have gone. Last time I read it, it was still complete. Maybe amazon complained, because their banner wasn't there too the last time.)