Some cards have a variable effect and allow you to choose ‘up to’ a specific number of targets or objects. Sometimes you search your library for cards when an ability resolves, like with Khalni Heart Expedition. In instances like that you choose the number to search for when the ability resolves. Other times you choose ‘up to’ a number of targets. As with all spells and abilities you choose targets when the spell is cast. Morbid Plunder would be an example of targeted spell that allows you to choose up to to targets.
In any instance where you can choose a variable number of objects targets, you can choose zero. In most cases it is not a good strategy. However it is possible to use this to your advantage. You can cast Frantic Salvage and not choose any targets in order to draw a card. Targeted spells and abilities are countered on resolution if all of its targets are not legal when it attempts to resolve. However, if zero targets are chosen, then the Frantic Salvage cannot be countered on resolution in this way.