How is effect precedence determined?

This is one of the harder and more intricate aspects of Hearthstone to know to play around. When multiple effects would occur simultaneously, such as deathrattle, or mass effects like Vanish matter regarding something, the order the effects occur in is always the order that the cards were put onto the battlefield. For instance, if your opponent has 9 cards in hand, and 4 minions on the battlefield, and you play vanish, the first creature your opponent ever played will be returned to their hand, and the other three will die, due to the maximum hand size of 10.

Directly from the Hearthstone gamepedia here, regarding specifically deathrattle, but also concerning all simultaneous effects:

"When two minions with Deathrattle die at once, both Deathrattles will take place. According to Lead Designer Eric Dodds, events such as Deathrattles that are triggered simultaneously will occur in the order in which the related cards were played.2 For example, if a Sylvanas Windrunner attacks another Sylvanas Windrunner, destroying both minions, the Deathrattle of the Sylvanas which was summoned first will take place first, followed by the Deathrattle of the Sylvanas which was summoned second."

The linked source in the gamepedia article is unfortunately a video, but you can watch it and hear the stated information for yourself here. The article also unfortunately reads this:

"However, player experience often directly contradicts this rule, even when repeatedly tested.2[3] While some have hypothesised complex rules of minion tiers and priority to predict and explain this behaviour, many reported experiences appear to directly contradict each other in the order of events. This variation may be due simply to bugs in the current build, or may reflect more complex rules underlying the game's behaviour."

But from the looks of the linked sources, the testing isn't very well done, and it's entirely likely this was a bug that has been since corrected, given how buggy of a game Hearthstone is. Either way, from the Lead Designer's words, the order of effect should be the order of minion placement.