As artificial intelligence infiltrates HR, employers face new legal risks when algorithms influence who stays and who goes.