Now that is a complicated question. But usually the main way its accomplished with what we call antitrust laws. When enforced (and the usa has enforced thrm but not as strongly as it should) they effectively make monopolies illegal.
Of course the other key is keeping corruption in check and money out of politics, which isnlikewise a difficult task to do, but critical to a healthy capitalism