What did skirmishers, such as Roman velites, do after they threw their javelins and fell back behind the infantry?
Typically skirmishers would be used to harass enemy formations and reduce their cohesiveness as they moved into position or maneuvered in the field. In some ways this could be seen as a side conflict, separate from the main action which would often(especially for Roman formations) be settled by the heavy infantry closing with and breaking the enemy front line.
Once the main battle was joined the skirmishers might carry out various roles, they could be used to continue harrassing enemy lines/flanks or used as a mobile reserve to plug gaps in the line. Some skirmishers were seen as light/medium infantry that could fight at close quarters if needed once their own heavy infantry had closed with the enemy. Skirmishers of various types could fulfill various roles as the battle developed.
TLDR: They may play no further part in the battle(if it goes well), continue to harass the enemy once the main battle lines joined or be used as mobile light/medium infantry and committed to the fight if required.
Edit: My assumption here is that you are asking about skirmishers on foot - you mention velites specifically. We need a longer answer if you mean mounted skirmishers/horse archers and so on.
They could also pick up used javelins.
And hoplites in Greece hated skirmishers. A hoplite out of formation could be easily killed by a lightly armed peltast as he could move faster and outmaneuver him quickly.
EDIT - thought I'd mention the source is Thucid. it's too late to go and find which exact line and chapter but Thucydides really disliked them Thracians and even scorned "allied" skirmishers who gloated to the captured Spartan hoplites after the Battle of Sphacteria