The business theory answer is that buybacks are used when there is no better investment opportunity.
Let's say the stock trades at 10 times earnings. Can you fund an internal project that's going to return 10% a year? [0] Can you buy another company that will return 10% a year? If not, then a buyback gives the best return to the company's owners (aka shareholders) because they owner larger slices of the same pie.
[0] Plus a small cushion for risk. And not just "we project this will return $HUGE amount" but something that can realistically happen.