All of these are endings which are attached to a person's name in Japanese, somewhat similar to how we use Mr., Mrs., or Ms. in English but more important and complicated.
In Japanese, you almost always use a person's last name, unless you know the person quite well or are a relative. Most of the people I knew and worked with in Japan had first names, but I never found out what they were unless I got a hold of a business card or other piece of paper. Instead, I simply used name-san: Takeda-san, Suzuki-san, or Ikeda-san.
These folks were colleagues at the schools where I worked. The suffix "san" (written さん) is safe, simple, and effective, and you can rarely go wrong with it. So when in doubt, just use "san" with the person's last name.
But Japanese has lots of other choices. "Chan" (written ちゃん) is the diminutive form of "san", and is used for people you are familiar with, comfortable with, close with, or otherwise know well. It's also used a lot more by women than men.
A man might call a woman "Satomi-chan" but would probably not ever call his male friend "Daisuke-chan", except perhaps when drunk, being facetious, or otherwise teasing.
Adults will often add the "chan" suffix to children's names, and some teachers will do so with students. But this varies depending on the situation, so it's best not to do so unless you are very comfortable and close with the people in question.
Also, "chan" can be a bit condescending, even insulting, depending on who is using it, when and where it is used, and the tone of voice. I've heard teachers use "chan" with a student's name as a way to suggest the student was too childish or immature, and parents do the same with their own kids.
The suffix "sama" (written 様 or さま; it's distinctive in that it can be written in Kanji and Hiragana) is special, reserved for when you need to be very polite. It is rarely used in speech, since the more convenient and common "sensei" is what most people actually say.
Though textbooks and dictionaries tell you "sensei" means teacher, it is used to address physicians, teachers or all sorts (from cram schools to prestigious universities, martial arts schools [dojo], and even Buddhist monks), as well as to address the person in charge of any academic organization, including the principal of a school or the director of a city board of education.
Where "sama" is used is in writing. It is what you put after the name on an envelope, and is also used after the name when writing a formal letter. It is also used when answering the telephone in a formal setting: "donata-sama desu ka" or "dochira-sama desu ka" being two standard ways of asking who is calling.
In some homes, especially where more culturally traditional views reign, you may also hear this use of "sama". Telephone etiquette in Japanese is a bit complex, and is covered in detail in Moshi-moshi.
The suffix "chama" (written ちゃま) is also special, usually used to be polite or respectful to someone who is otherwise your equal. When I was in interpreter and translator training, one of my classmates was an amazingly gifted student, already better than half our teachers, and also half their age. So we often called her "Keiko-chama", and she would of course be very humble about it all (she's now off doing amazing work as a conference interpreter, by the way).
There is also "kun" (written 君 or くん, but usually the former), used like the ones above, but reserved for people who are below you in the social order. For instance, teachers sometimes use "kun" with students' names, though often they just use the name with no ending at all. Senior people in companies and organizations will often use "kun" with juniors' names, though again, some don't bother with the ending at all.
There is much nuance to all this. The above is a rough guide. Living in Japan and seeing how it all works on a daily basis is the easiest way to learn. When you first arrive, the safest thing to do is to follow the lead of those around you. If everyone in your group is using "san", go with it. You won't stick out that way, and in Japan, the nail that sticks out gets pounded down.