In the Wittig reaction, why do stabilised ylides produce E-alkenes and unstabilised ylides produce Z-alkenes?
I have given some justification on why unstabilized ylids give Z-alkenes in this answer of mine.

A possible explanation why stabilized ylids show E-selectivity is given in the organic chemistry textbook by Clayden, Warren, Wothers and Greeves on p. 817: