When do you use 唄 instead of 吧 to end a sentence? I hear a lot of people in mainland China use the former (never from Taiwanese Mandarin) when saying a phrase as a sort of command, but I'm still not sure about why someone would say it.
Their meanings are somewhat different. In a few situations, they are interchangeable, but there are many others where you can only use one and not the other. The key difference is that 呗 is much more assertive, even rhetorical, whereas 吧 can be used to express doubt or uncertainty as well. For completeness I'll cover them all.

Definitions taken from zdic.net

呗


  (1) 表示事实或道理明显,很容易了解。如:你不会骑车就学呗
  
  (2) 表示勉强同意的语气。如:你一定要去,就去呗


吧


  (1) 用在句末,表示恳求、提议、请求、命令等语气 [(used at the end of a sentence) indicating entreaty, suggestion, command, etc.]。如:派六个人不够吧,我的意见派十个人;你说给大家听听吧!
  
  (2) 用在句末,表示同意、认可的语气 [indicating agreement or acknowledgment]。如:好吧,我一定去;就这样执行吧
  
  (3) 用在句末,表示疑问语气,带有揣度的意味 [indicating doubt]。如:他现在赞同了吧?你弄通了吧?
  
  (4) 用在句末,表示估量、推测语气 [indicating uncertainty]。如:他自己总该知道吧;老王会到这边来吧
  
  (5) 用在句中,表示停顿,带假设语气,并带有列举性质 [indicating a pause]。如:说吧,不好;不说吧,也不好



When expressing a foregone or obvious conclusion, you can only use 呗. Let's examine the example:


  你不会骑车就学*呗*


Here the speaker is saying that the solution, to learn how to ride a bike, is obvious, and doesn't need asking, as if the question was rhetorical. If you change the 呗 to a 吧, then the implication changes:


  你不会骑车就学*吧*


Here the solution of learning to ride a bike is more of a suggestion, and that other solutions may also be valid.
When expressing reluctant agreement, use 呗, although 吧 can also be used. Let's examine this:


  你一定要去,就去*呗*


Here the speaker is expressing reluctance that "you" have to go. The speaker could replace it with 吧:


  你一定要去,就去*吧*


But unless expressed elsewhere with tone or context, the tone of this sentence is ambiguous, and not necessarily reluctant.
When used as a suggestion or command, you can use either 吧 or 呗:


  你说给大家听听*吧*!
  
  你说给大家听听*呗*!

When expressing agreement or acknowledgement, you would use 吧. Sometimes you can use 呗 as well, but watch out for its more assertive tone:


  就这样执行*吧*
  
  就这样执行*呗*

When used to indicate doubt or uncertainty, you can only use 吧:


  你弄通了*吧*?
  
  老王会到这边来*吧*

There's another special use of 吧, as a pause in speech. In this manner, it is interchangeable with characters like 呢. 呗 doesn't have this usage.


  说*吧*,不好;不说*吧*,也不好