How can I balance data classes?

Some ML algorithms like BDT require balanced sample number for each class or it may produce bias. But our physical problem usually have a small number of signal and large number of background, how do you balance the classes?

For example, when expected signal number is 100 and background one 10^4. What can we do to balance them? Can I use same number of them, like 10^4 for each and add a weight? What will happen if I set 10^6 samples for signal and less samples like 10^4 for background one? Should I constrain sample number * weight = expected number ?

When there is one more background, background two with expected number 10^6, what should I do? Should I combine two background to a " whole background"? Or can I analysis it one by one?