When cooking the pasta, it leaves a good amount of starch in the water. The starch granules in that water, when combined with the olive oil, bond instantly, swell a little bit, and create a glossy sauce that coats the pasta nicely.