Look in section 6 of my article "The Weil Pairing and its efficient calculation" http://tcs.uj.edu.pl/~mistar/pdf/Miller2004WeilPairing.pdf (Wayback Machine)1. It has the details that you want (much along the lines of Robin Chapman's answer).
1Miller, Victor S., The Weil pairing, and its efficient calculation, J. Cryptology 17, No. 4, 235-261 (2004). ZBL1078.14043.