Consensus-based optimization on hypersurfaces: Well-posedness and mean-field limit