Some spells and abilities which give you or say you “may pay” some amount of require one or more targets. If each target chosen is an illegal target as that spell or ability tries to resolve, it won’t resolve. None of its effects will happen, you won’t get any from it, and you won’t get the chance to pay any for its effects even if you want to.