Any GM worth his salt is aware of what teams have expiring contracts in a given year. More specifically, contending teams are aware of rebuilding teams that have expirings. If rebuilding teams have expiring veteran contracts that they were unable to trade at the deadline, there is always a fair chance that they'd be willing negotiate a buyout to save the franchise money (and provide the veteran to go to a contender). That's merely due diligence.
So yes, Ainge was aware that certain veterans on certain struggling teams might well be available. As expiring contracts are often times viewed as highly desirable purely for the financial benefits, sometimes those same struggling teams can turn the expiring contract into better talent (but with more onerous (read longer) contracts. So there's the added risk that the veterans that Ainge had targeted might be traded and thus unavailable.
Add to that possibility that even if bought out, the player might choose a contender other than the Celtics to latch on to, and there is a definite risk factor.
The whole buyout phenomena seems of recent vintage to me. Not something that you could take to the bank as a given. PJ wasn't even a buyout. He came out of retirement (thankfully). Sam was brought on board as insurance in case Rondo was deemed unready.
There is foresight involved, but there is no denying that there is luck involved as well.
As to being surprised by the KG and Ray signings, and whether they were part of a plan, I'd just say that Danny had skillfully positioned himself to be in a flexible position.
They were certainly not plan A. Plan A was tanking the season and Getting Oden or Durant and putting them beside Pierce, Jefferson and Rondo. When that went out the window, Danny immediately had to decide whether he was going to keep Pierce and cash in his chips immediately, or lose Pierce and continue with the slower build. We all know how that went.
More than anything, Danny deserves credit for recognizing, when he took over, that what he inherited had no upside, and no real shot at contending, and having the courage to dismantle it. Every move was about upgrading talent, even when it involved taking on guys with less than stellar reputations, character-wise, and even when it meant going with young, talented guys who were not yet ready to win, but who ultimately had more value on the market.
I always knew that Danny would trade some of them in. Had no idea that he'd go the all in strategy that he eventually took. I think his hand was a bit forced, in that it was either cash in or lose Paul. Once he got rid of that 5th pick, 'all in' was really the only way to go, because just picking up Ray would not have put us even near to championship contender.
Anyway, just observing that the fact that Danny was well aware of which veterans might be buyout candidates is no earth shattering revelation. It's the mere due diligence that any competent GM would do.
Beyond that, yes, there was some luck involved, and this present path we are on is very much owing to the serendipity of ping pong balls, even though at the time it seemed like the end of the world. He did a [dang]ed good job of acquiring assets with which to trade (the proof being that teams did actually trade for them). In Danny's case, flexibility served him well.
My view is that Danny took a calculated risk by not addressing a couple of the needs during the off-season, and fortunately it paid off, but risk it was.
I still would be more comfortable with a rugged and reliable veteran swing (bigger than 6'4"), so that has gone unaddressed, in my view. Still, Marbury is an extraordinary talent to have gotten at such a bargain basement price, and hopefully his effect on the second unit will be enough to get us over the hump.
Sorry for the full length novel.