Well to teach something like the basketball trick, you would probably want to have mastered a few simpler ones first (wave, spin, nod yes/no etc).
The way I would go about it is to teach the retrieve behaviour first. It is all done in VERY small stages.
First you would reward the bird for picking the ball up, thats it.
Once he has learned that - reward him for picking it up and doping it after a short while (most likely do this naturally if he knows he's going to get a reward).
Then you would put your hand underneath so he drops the ball in your hand and only reward him when he does.
Once he understands he has to drop it in your hand, you can move your hand further and further away until he picks it up and brings it over to you.
Then you gradually substitute the hand for the basket by placing your hand over the top of the ring - so that it falls in.
Anyway,thats how I would do it, and how most sources suggest you do it

. its all about only rewarding the correct behaviour.