How long can food last if reheated periodically? Say I fixed some stew that's been in the refrigerator for around three days. Will putting that stew in a pot, heating it up to around 170F (77C), and letting it simmer for a while make it last longer in the refrigerator? And if so, then can this be done (nearly) indefinitely?

I think the answer is yes, because whatever microbes have had an opportunity to take root in the food will have been killed by the high temperatures, but I am not sure about whatever biproducts that might remain (e.g. toxic chemicals exuded by the microbes as part of their metabolism or something).
Yes, it will "make it last longer in the fridge" for a certain definition of "last longer": it will not mould nor infect other foodstuffs in the fridge if it doesn't come into direct contact with any of them.

Is it still safe to eat after a few of these re-heatings? Very probably not! 

Elaboration: More then half of the number of cells in your body are actually bacteria; bacteria don't generally kill you but the toxins they release is what kills you.  E.g. Botulinum Toxinum D (one of the toxins released during Botulism) has an LD50 of 0.4 ng/kg, which means that you need about 500g (a pound) to kill 99.9% of all human beings on the entire planet...

(And that is for just a few re-heatings; for "nearly indefinitely" we need to bring extremophiles in the equation...) 

Related, but not identical question