Enchantments are completely random. There is no way to guarantee which enchantment you will get.
From the wiki
The level requirement influences the quantity, type, and level of enchantments instilled in the item, with a higher experience level generally resulting in more and/or higher-level enchantments. Nevertheless, there is a heavy random factor, and even a level 30 enchantment (the maximum) doesn't guarantee more than one enchantment, nor even that enchantments will be "maximum strength" — a level 30 enchantment can still yield Fortune II or Efficiency III alone, for example.
If you don't want to waste enchantments on equipment, I would suggest trying to enchant books instead. This is slightly more resource intensive, but that way, later you can combine books in an anvil to get stronger enchantments, and even apply a specific set of enchantments of your choosing to the equipment you want to enchant.
Post-Note: I have actually found that if you are looking for a bow with the "Infinity" Enchantment specifically, you will actually have better luck with fishing.
- You can start off with an un-enchanted fishing rod; with luck you will eventually find a rod with the "Luck of the Sea" enchantment (Lowers chance of "junk" catches by 2.5% per level and increases chance of "treasure" catches by 1% per level)
- If you then use this, you have an increased chance of finding an enchanted bow - I personally have had much better luck of getting a bow with the "Infinity" enchantment this way.