The aim of this PhD thesis is to provide a better understanding of the determinants of observed educational outcomes internationally, by focusing on two potentially important vectors of educational attainment: classroom peers and gender. The first part of the thesis (Chapter 1 to 4), written jointly with Ohto Kanninen, proposes an explanation to the gender gap reversal in educational attainment observed internationally over the last decades. We explain this quasi-universal phenomenon by building on a quasi-universal fact: the greater dispersion of men's test score distribution relative to women's test score distribution. In Chapter 1, we establish the fact that the gender gap reversal in educational attainment occurred in both the upper tail and lower tail of educational attainment, and that this reversal has been observed internationally. Chapter 2 shows that a greater dispersion of abilities among males, combined with an increase in the returns to education across cohorts, can generate the relationship between the total enrollment rate in education and the gender ratio among the enrolled observed in the data. In Chapter 3, we estimate our model empirically, and shows that our theory can reproduce the dynamics of educational enrollment by gender in each individual country in our sample. Finally, Chapter 4 formulates alternative theories proposed by the literature in the theoretical framework developed in chapter 2, to allow comparisons with our theory and confrontation against empirical data. It shows that the data does not support some of the predictions of the previous explanations proposed by the literature, while being consistent with the implications of our model. The second part of the thesis (Chapter 5) draws on the now large literature on peer effects in education to investigate the potential effect of immigrant peers in the classroom on the acquisition of basic cognitive skills by natives at school. It exploits a rich panel dataset of primary school students in the Netherlands and uses small variations in immigrant concentration across cohorts to identify the treatment effect. It performs a battery of tests showing that the variation in immigrant concentration in the classroom used for identification resembles a random process orthogonal to other determinants of educational achievement. It find evidences for a small negative effect of immigrant presence in the grade on the achievement of natives in reading, but not in mathematics. The treatment effect is also found to be very heterogenous depending on the characteristics of native and immigrant students.