You ask how you can understand. Each key (of which there are 12 majors and their relative minors- more later) have basically six main chords which are found in each. Going alphabetically, they are, starting with the key name itself, major, minor, minor, major, major and minor. As in, for example, key of C maj.: Cmaj, Dmin, Emin, Fmaj, Gmaj and Amin. For these purposes, the 7th chord, made from the 7th note, won't matter.The 12 majors will have 3 maj. and 3 min. chords in each, likewise, the 12 minors will have 3 maj and 3 min. E.g.: Amin.: Am, (miss B) Cmaj, Dmin, Emin, Fmaj, Gmaj.Note that it's the same list, just in a different order. That's because Cmaj and Amin are relatives.
Armed with this info., you can trawl through the 12 keys and find which set of chords have been used for the song. You'll probably need 3, as with only 2, there will be an overlap of keys (for instance, Am and Em both belong to keys C and G- but if there's an F chord, it's more likely the key will be C rather than G, as G doesn't use F as a rule.
When that's been discovered, you have your set of notes, aka scale. It's useful to know that the notes for, C, for example, are the same as for Amin - sometimes with the exception of a G# instead of a G in the scale. The reasons are abundantly available in other answers on this site.
Thus, Shev's answer of C or Amin scale notes is correct, given that Am, Dm and Em all belong to C/Am.In other keys, it's important not to ignore #s and bs.