In short, ć, ź, dź and ś are alveolo-palatal consonants, all articulated with the tongue raised towards the alveolar ridge (located just behind the upper teeth) and the palate (the roof of the mouth behind the alveolar ridge):
On the other hand, cz, ż, dż and sz are retroflex consonants, all articulated with the tip of the tongue pointed upwards or even bent back (hence the name):
Note that English ch, s (as in "pleasure"), j and sh are similar to the sounds in question, but are palato-alveolar. It means that English ch is articulated somewhere in between Polish cz and Polish ć, and so on.
If you are familiar with sounds of Serbo-Croatian, it may be helpful to note that Polish ć is basically the same as Croatian ć, and Polish cz is similar to Croatian č (I'm not quite sure if the latter is retroflex or palato-alveolar). Similarly, Polish dź is the same as Croatian đ, and Polish dż is similar to Croatian dž.
It may be easier to tell sz from ś if you know some Russian: Polish sz is pronounced the same as ш in Russian "шут", and Polish ś is similar to сч in Russian "счастье" (but somewhat shorter).
Finally, take a look at the transcription of these consonants in the International Phonetic Alphabet. It may be useful if you want to look them up in Wikipedia or find them in pronunciation charts to learn more about how they sound.
ć [t͡ɕ] cz [t͡ʂ]
dź [d͡ʑ] dż [d͡ʐ]
ś [ɕ] sz [ʂ]
ź [ʑ] ż [ʐ]