The brothers see Joseph from a far and they plot to kill him and throw his corpse into a pit. They agree that they will tell Jacob that Joseph was killed by a wild animal. We are not told which brothers. But when Reuven the eldest hears about the plot he replies, “Do not spill blood.” All well and good except he also agrees to throw Joseph into a pit. The Torah goes on to say that his intention was to save Joseph and return him to his father. Reuben then disappears. Where, why did he go? Were they all in the same place or split into cliques in different zones? The brothers clearly are divided amongst themselves.
The bothers look up. See a caravan of Ishmaelites (cousins remember). And Judah suggests selling Joseph instead of killing him. Them Midianites pass by and they pull Joseph out of the pit. Did the brothers sell Joseph to them? Or were they simply the middle men? And once again the text says that Joseph was sold to the Ishmaelites. And they took him down to the slave market in Egypt. But then some ten verses later the Torah says “The Midianites sold him to the Egypt.
Who sold Joseph? Of course, as you would expect the Midrash has various theories. To give a few. Joseph was sold several times. The names Midianite or Ishmaelite were just general terms for traders. The first Ishmaelites simply gave the idea of trading Joseph in the first place instead of killing him. They sat and chatted and then later, did the deal.
Whatever, Reuben comes back hoping to take Joseph home. Finds him gone Knows he is going to be blamed. The brothers all agree to lie and say they don’t know what happened to him but will bring back his special coat all bloodied and torn and claim they found it. And it indicates he has been killed.
Then the scene shifts to Judah now living far away from the other brothers. In exile so the Midrash says because he is the one who arranged fir Joseph to be sold. The dynamic between Reuben the eldest son and Judah the most pro-active and dynamic will play out again and again.