Given the Halting problem, I’m trying to reduce it in order to show that $ \left\{ \left( \langle M_1\rangle,\langle M_2\rangle \right)| L(M_1)=L(M_2) \right\}$ , where $ M_1, M_2$ are Turing machines, is undecidable. I’m having some trouble making sense of the answer given here. Why do we assume that $ M$ will finish reading $ x$ exactly after $ |x|$ steps? And if $ M$ doesn’t halt, why does $ M’$ automatically accept the empty language, i.e return the constant zero function? Can it not except other strings, not just $ x$ ?

I would appreciate it if someone could break down the general idea of that answer or maybe give me a few hints on how I can approach this problem differently.