At the end of a sentence in a conversation, how does one distinguish between 吧 and 嘛, 罢 and 嘛?
Well, in our normal life, 吧 is usually used for the moments when you are guessing/questioning/acquiring/normal words ending/agree.... 吧 can be used in many situations.
But 嘛 is a little kind of "spoiled", totally used between friends and girl/boy friends, also used for acquiring, not used for guessing. It's sometimes used when you are angry. “好嘛，你竟然骗我！”
罢 is a little kind of "compromise", or "have no choice". It's usually used in literature; it's not normal to use it in daily life.
Situations where 吧 is used:
- 一起（together) + Verb + 吧: When expressing the meaning "Let's (together)".
一起去吧。 => Let's go.
- Adjective/Verb + 吧: When suggesting others to do something. (Imperative, but not that authoritative) (Let it be ...)
去做吧。 => Just do it.
快点吧。 => Be quick.
好吧。 => Okay. (Let it be good.)
- Adjective/Status Verb(是, 有，死，坐) + 吧: Expressing rhetorical mood, when you expect the listener to agree with what you say.
今天是星期六吧？ => Today is Sunday, right? (Isn't it?)
你还好吧？ => You are still OK, aren't you?
Situations where 嘛 is used:
- When the listener does not realize the fact, and you want him to be acknowledged of that. Use this when wanting to express in a soft tone.
他就是这样的人嘛！ => He is a person like that!
- Put right after subject: I think there is no difference except to emphasize the subject. For this usage, 就 is usually used in the next sub-sentence.
讲到我本身嘛，我只有这句话。=> Talking about myself, I only have this to say.
For the word 罢:
Verb + 罢: As the word 罢 can be written as 作罢(finish and not doing again), this ending could, in some sense, means to end doing something. BUT! In my view, except the following situation, 罢 has no difference with 吧.
说罢，他就走了。=> As soon as he has spoken, he left.
罢 could also be treated as a verb, which can be used in the middle of a sentence. But since I only want to focus on endings, I will not discuss here.
(Though Chinese being my mother character, I only see it in books, but have never used it before. If you have more examples, just tell me)
There is also a sentence ending: 罢了. This means "just".
她只是做了功课罢了。 => It is just that she finished her homework.
There may be other situations that I miss. Welcome to correct anything.
吧 is almost used at the end of a sentence (except when it's a phonetic transliteration of the English word BAR, as in 酒吧，网吧), to express several moods.
when you guess or estimate something 这道题目的答案是A吧。 The answer to this problem is A (I guess it should be, but not sure)
When you try to persuade someone to do something or propose a plan/advice/scheme, etc. In this case, the word 吧 softens your voice, so it's not a strong proposal. 六点了，我们去吃饭吧。 It's 6 o'clock. Let's go to take a dinner. ( Is that fine?) 不要跑，等下一班车吧。 Don't run. (You may) wait for the next shift of bus. (In my opinion).
when used at the end of an phrasal verb or imperial sentence, 吧 can express strong feelings that you are extremely angry or excited. In this case, you may speak this word louder. 燃烧吧，小宇宙！ A famous line from the popular Japanese manga Saint Seiya. Who can knidly give me a good translation?
When you feel that something doesn't deserves your concerning, or when you think that your can do nothing to help. 分手我不怕，就这样吧。 A sentence from the lyric of the song 一夜长大 by famous singer 梁静茹。 I'm not afraid of breaking up. Let it be.
The word 罢 can be interchangeable with 吧, as a mood word. However, I think this usage is outdated and less and less popular. You may read it often in old articles. For example, articles by 鲁迅. In his time, the modern Chinese started developing, so some rules/words are not fixed, I think.
As a verb, 罢 can mean “to finish, to abandon, to dismiss” . As other answers pointed out, you can use it at the end of a verb to indicate the action has finished. This function is similar with the particle in English . 说罢，他就跑了。 (Finishing) saying (that), he runs away.
嘛 is more confusing.
I'm from Southwest China. People here prefer 嘛 to 吧 and it is used whenever 吧 can be. When speaking in the local dialect in my ordinary life, I never say 吧. However, I always use 吧 when speaking in Mandarin.Also, I seldom find 嘛 on television and newspaper, so I think 嘛 is more a regional choice. Can someone from other regions tell me how 嘛 is used there?
I'd like to treat 好嘛 as a single word, other than a compound of 好 plus 吧. I can't catch up with other words in this pattern.
嘛 can mean "what" in oral speech, and this usage is common. If I'm not wrong, people from 天津 region use this quite a lot.