In most DMD games the bonus value is, as said above, magic mixed with math.
On sterns it's usually something like
125k * ball in play + X * switches hit + Y * some subset of switches hit (pops or slingshots or whatever)
Where X and Y depend on the game.
The short answer is "it depends, and it's usually not worth caring about".
Other games have very specific bonus counts: in Tron it depends solely on how many of the lights on the ladder are on or blinking. In WOz a large part of the bonus is how many Yellow Brick Road shots you've made. In AC/DC it's a count of your 'song requests' and songs played.
Many Bally/Williams games from the 90s included some or all of the points from various things (modes, especially) in the bonus. Why? Who knows. Started with Addams Family. Generally these points are not_ multiplied by the bonus multiplier, but are added after the multiplication. This was popular through at least Shadow, where your bonus was often half your score.