Non-simple geodesics on surfaces