General Motors on Monday said it would invest $500 million in Lyft, the ride-hailing service, to develop a network of autonomous, on-demand cars. In the more immediate future, the partnership will allow Lyft drivers to rent GM vehicles at a discount.