And how did Ravana captured it from Kubera?
Ravana captured Pushpaka by defeating Kubera in a battle:
Thus he wore full many forms and he was not visible in his native shape. And then, O Rama, seizing a mighty weapon the Ten necked one, whirling the same, brought that redoubtable mace down on the head of the bestower of riches. Thus smitten by him, the lord of wealth, bafled, toppled down to the earth covered with blood like an asoka whose roots have been hewn away.
Thereat Padma and other Nidhi deities, surrounding the granter of wealth, raised him up and brought him to the Nandana wood. Conquering the bestower of wealth, the lord of Rakshasas, with a delighted heart, possesed himself of his Pushpaka, the car, as a sign of victory ;furnished with golden pillars, gateways set with lapises, covered with networks of pearls, having trees yielding the fruits of all seasons, endowed with the celerity of thought, ranging everywhere at will, weaing forms at pleasure, capable of coursing in the sky, with golden and jewelled stafs, and daises of polished gold, the vehicle of the gods undeteriorating, bringing delight to the mind and sight ;wonderous exceedingly :painted with images designed to fill the mind with reverence, constructed by Brahma, containing all objects of desire, charming and nonpariel not cold and not yet hot, granting gratification in every season, and graceful to the view. And ascending that (car) coursing at will, won by his prowess, that utterly wicked one, out of swelling insolence, deemed himself master of the three worlds. Valmiki Ramayana, Uttara Kanda, Sarga 15
How does the chariot come to lord Rama in the war?
That wonderful aerial car, Pushpaka which was seized by Ravana once, went in speed to Kubera, as impelled by Rama's advice. Valmiki Ramayana, Yuddha Kanda, Sarga 127
After that Pushpaka return back to Shri Rama by the command of Kubera:
Having bade adieu unto Rikshas, Vanaras and Rakshasas the long armed Rama began to live happiiy in the company of his brothers. Thereupon he and his brothers heard from the air the following sweet accents: O gentle Rama, do thou with a delighted countenance behold me. O lord, know me as Pushpaka coming from the abode of Kubera.
O foremost of men, at thy command I did go there to carry him. But he said to me Having slain the irrepressible Ravana in battle the high souled Rama, the foremost of men, hath conquered thee. I have greatly been delighted on the destruction of the vicious souled Ravana, with his relatives, sons and friends.
Then Shri Rama accepted him and used his services:
Having said this and worshipped it with dried paddy, fragrant flowers and incense, Rama, having long arms, addressed Pushpaka "Do thou go now and come here whenever I shall remember thee. While proceeding by the welkin, O gentle one, be not sorry for our separation. And be not obstructed in thy course whilst traversing all the quarters. Valmiki Ramayana, Uttara Kanda, Sarga 51