That is a lot of questions, actually.
Fly
PFSRD on the matter:
You generally need only make a Fly check when you are attempting a complex maneuver. Without making a check, a flying creature can remain flying at the end of its turn so long as it moves a distance greater than half its speed.
The complex maneuver table there lists the actions possible (fly slowly, hover, turn sharply, ascend steeply). Less drastic maneuvers should be generally possible without a check. Please also note, that it gets a modifier to the Fly check from its maneuverability and size.
The Wingover feat allows it to turn 180 degrees for free once per turn, as opposed to expending movement and making a Fly check.
Attack
Talons are claws on the bird's feet. They are accessible when it is airborne; they are even accessible when it is standing on the ground (jumping a bit with a bit of help from wings).
It can attack 3 times if it takes a Full attack action; it is possible maintain an airborne position in that case with a successful Fly check to hover (since Fly checks do not consume an action). Please note that this method is not dependant on Wingover feat.
Without the Multiattack it does get a -5 modifier to all secondary attacks.
Which attack is primary or secondary depends on the attack type, and is indicated in the Universal Monster Rules for Natural Attacks. Bite, claw, gore, slam, sting and talon attacks are always primary. Other attacks can be primary if a creature doesn't have any of the aforementioned types. Primary attacks use the full Str modifier to damage (or 1.5x if the creature only has a single natural attack, or for special cases), secondary attacks get only 0.5x Str to damage, and are made at a -5 modifier (or -2 with the Multiattack feat).
For the Roc, all listed attacks are primary and get full Str to damage. The Multiattack feat has no effect since it only affects secondary attacks.
Tricks
Simple movement does not trigger a Fly check; a steep ascend and a sharp turn, on the other hand, does.
The attack of opportunity is triggered by many things, but in relation to movement it is triggered when someone leaves a threatened square. So if it initially was not in anyone's reach, an optimal movement to flanking position probably won't trigger any AoO's, since it will only enter a threatened space.
Maintaining a flanking position, given the opponent does not move, is a matter of a Fly check to hover (or standing on the ground), so no AoO's here.
Be careful not to confuse the two entities shamans work with: one is a spirit, the other is a living animal representing that spirit in the physical world.
First, no, the spirit animal is not an animal companion. It is a living creature that mostly works like a wizard's familiar:
[The Spirit Animal] ability uses the same rules as the wizard's arcane bond class feature and [the spirit animal] is treated as a familiar, except as noted below.
So it can only fight for you as much as a familiar normally can, using its natural abilities. It doesn't advance like a druid's animal companion, and if it's killed you're hooped for spellcasting for at least a little bit.
Yes, you need to have your spirit animal with you to prepare spells, as it is the conduit to the source of the shaman's spells:
A shaman must commune with her spirit animal each day to prepare her spells.
So, a concrete example might help. If you have a bond with the Spirit of Otters, you would commune with that spirit via a living otter, which is called your spirit animal. If the otter is slain, a new otter would have to be found to serve as a conduit to the Spirit of Otters. The otter can fight for you, but that's risky and otters are not great fighters, nor will the otter ever become a great fighter.
Best Answer
Yes, you would make the check during your turn, and if successful, you have communicated to the animal that it is to attack that target. The rest works just like if you talked to another humanoid and told them to attack that person. If they choose to comply (which the trick ensures the animal will), then they must wait until their own turn to act on the command.
As for how long they keep attacking on one command, the RAW is somewhat more ambiguous on that point, but the description of the "Down" trick seems to imply that the "Attack" trick lasts until the enemy being attacked is taken down or until something such as the "Down" trick or severe injury motivates the animal to fall back.