Sneak attack damage always applies if the target has lost their dex bonus, is flat footed, or is flanked. It does not matter whether the attacker with sneak attack is making the attack during their turn, as part of a readied action, or as an AoO. All that matters is that the conditions for sneak attack be in place at the time the attack is made.
Lets say a player attacks the enemy that had sneak attack. The enemy makes their attack. Next round the player decides to move out of the enemies attack thus provoking an air. Does the enemy get sneak attack damage at this time if the hit the player as the player moves away?
Unless the moving player has lost their for some other reason, of course, but the action you describe would not qualify.
If you provoke an attack of opportunity by someone with sneak attack, would you take sneak attack damage?
As others have said, only if the attack otherwise qualifies to deal sneak attack damage. Provoking an attack of opportunity by itself does not qualify.