On the distribution of a cotangent sum