Of the 12,000 species of ants roaming around the globe, 700 live in the US. Of the 700 just 25 prefer indoor housing. The argentine ant, carpenter ant, harvester ant, little black ant, odorous house ant, Pharaoh ant, red imported fire ant, Southern fire ant, and thief ant are local and the most likely to be close to or in our homes.
Though they identify as separate species (that are not so simple to identify) the various varieties have similar lifestyles. Ants are organized. They establish colonies anchored by one or more queens who busily reproduce while supported by a multitude of workers. To survive ants need a water source and food and, being commensal, they are happy to live close to people and eat some of the same foods we do.
When you see ants marching one by one or two by two—hurrah—they are scouts deployed with the mission of searching for sources of water and opportunity. Choice spots are bathrooms and kitchens, sites where they can settle in. Scouts report back to the colony and recruit ant troops. They are swift to gather around any food opportunity and they aren’t picky. This is no picnic.
Troops then carry water and edibles back to the colony and the queens.
Keeping them out of your house is of course is a good solution. Try: close any entrances and clear tree limbs, logs, firewood and any other inviting colony sites away from your house. Seal any water leaks and aim gutter and drain spouts outward.
Meanwhile, if they do settle inside, it’s time to super clean your kitchen and bathrooms including floors and cabinet tops to eliminate ants deposits and chemical scent trails they leave to retrace their steps to and from their colony. Store foods in sealed containers or safe inside your refrigerator.
While the urge to spray an insecticide on the visible ants appears to be a cathartic solution, it will most likely be a Pyrrhic victory at best. Those ants represent just a small regiment ready and able to relocate. Lethal insecticide baits that ants ingest and carry back to share with the colony and queen(s) are a better method. FYI you can make a DIY bait lure by mixing borax and sugar. Or there is always a pest management professional.