In the books, how does Arya retain her sword 'Needle'? She gets captured and traded around umpteen times. How does she still have Needle when she goes across the narrow sea?
She actually loses Needle for a significant length of time.
According to Sean Duggan's reference in this wiki entry on Needle:
A Clash of Kings
While travelling North, Arya continually practices at swordplay. Arya lost the sword to Polliver when she was captured by Gregor Clegane's men in the Riverlands. …
Arya and Sandor Clegane (The Hound) saw Polliver and The Tickler and one of their associates at the Inn at the Crossroads. Sandor's tone was bristly towards the gathered men, who were pointing out that he now had a significant price on his head, after his defection from the Lannister's at the battle of King's Landing. Inevitably, a pitched fight erupted.
Sandor slay Polliver pretty quickly, but suffered a wound to the leg, as he is fighting The Tickler Arya grabs a blade & stabs him from behind and finishes him off with a series of stab wounds, while shouting the questions he asked of the people he'd killed.
After the main fight, 'the boy' lay dying with a stab wound to the stomach..
The boy didn’t seemed to hear him. “I came for the girls,” he whimpered. “… make me a man, Polly said … oh, gods, please, take me to a castle … a maester, take me to a maester, my father’s got gold … it was only for the girls … mercy, ser.”
The Hound gave him a crack across the face that made him scream again. “Don’t call me ser.” He turned back to Arya. “This one is yours, she-wolf. You do it.”
She knew what he meant. Arya went to Polliver and knelt in his blood long enough to undo his swordbelt. Hanging beside his dagger was a slimmer blade, too long to be a dirk, too short to be a man’s sword … but it felt just right in her hand.
“You remember where the heart is?” the Hound asked. She nodded.
The squire rolled his eyes. “Mercy.”
Needle slipped between his ribs and gave it to him.
Martin, George R. R. (2011-02-24). A Storm of Swords (A Song of Ice and Fire) (p. 1034). HarperCollins Publishers. Kindle Edition.