Ammunition includes bullets, darts,1) arrows, and quarrel (bolts). Daggers, javelins, spears, and throwing hammers do not count as ammunition. Remember that spears may be broken by their targets.2)
Non-magic ammunition is always lost when used. It cannot be recovered.
Magic ammunition has a 50% chance of recovery if it does not hit its target.3) A player can roll d6 for every magic shot missed; a shot is recovered for every die showing 1-3.
Since daggers, javelins, and throwing hammers are not ammunition, they can always be recovered under normal circumstances. However, note that many magical javelins indicate that they are used in the throw, or at least that their magic is only useful for one throw.
Listed XP and GP values are per individual ammunition. For example, 6x bolt +1 would be worth 120 XP or 720 gp.
Even though javelins aren't considered ammo, it's worth mentioning that their listed GP/XP value is for individual javelins, just like with ammo.4)