Ants are an important component of the garden ecosystem. Ants are cleaners: they eat and help decompose organic matter in the soil, enriching the soil. Ants also eat pest insects such as fleas, fly larvae, and termites. Ants tunneling in the soil improve soil aeration which is helpful to plant roots.
Ants become a garden pest when they eat living plants--usually seedlings, weak, or dying plants--and cultivate colonies of insect pests such as aphids, scale, and mealybugs (these bugs excrete a sugary substance called honeydew which ants eat--ants will farm these insects to ensure their own food supply).
Ant pests can be repelled or killed. A few ants in the wrong place are not a major concern: repel or deter these ants--they will go elsewhere and likely do no harm. Large ant nests in the middle of the garden are a concern; these ants may be eating young plants and cultivating insect pests. Pest ants should be eliminated before they take over the garden.
A bit of background: there are more than 14,000 species of ants. Each species has its own way of living, colonizing, and feeding. You may have to change up your ant control game plan if one method does not solve the problem. Ants can adapt to control strategies.
Ants live in colonies or nests. Ants have a caste system: a queen, worker ants, solider ants, and male ants. Eggs are laid by the queen. The ant lifecycle moves from egg, to larvae, to pupate, and adult. The ants you see around the entrance to the nest are foragers--they collect food and bring it back to the colony and queen. The ants you actually see comprise about 10 percent of the total colony.