I’ve studied renaissance warfare intensely and I still find myself questioning this. Bows seem to have a high rate of fire and retain armor piercing capabilities, half of the time it seems like European rulers (like the French infantry in Italy) only used guns for the gimmick and fashion of the thing. Which is truly the more effective weapon system for infantry?
The way a European ruler would answer this question relies on his country of origin, forces he has under his command and territory he wishes to conquer. In short, guns were absolutely the best preferrable weaponry for the infantry masses during 17th century, but bow had its uses, primarily in Eastern Europe, used by cavalry and scouts.
​
A bowman is much harder to train than a musketeer - making a good bow is a difficult task, and exercises needed to become at least average at archery are much more numerous and require prolonged periods of time. Muskets retained excellent piercing capabilities, could be easily produced in big numbers and teaching a soldier to properly shoot with one was relatively easy. Muskets were incredibly useful in any situation - a reason they would take enormous place in militaries of Europe, Ottoman Empire, China and other countries starting with 16th century.
​
A bow still had its advantages - primarily ability to rapid fire from the horse (other shooting capabilities for the rider were pistols and carbines, both quite inaccurate and still very slow), harrassing their opponents and pinning them down unless they are ready to stand under the arrowstorm in battle. This reason is why multiple Eastern European forces still had their mounted scouts ready: horse archers were still the biggest part of the Crimean Khanate military, Russian Tsardom utilized feudal levy (pomestnaia konniza) and Tatar/Kalmyk vassals and Poland had pancirnie cossacks, mounted units skilled in use of both firearms and bows. In Eastern Europe, with long distances an army had to travel and ability to deploy multiple scouting parties meant it was crucial to maintain groups of light horsemen able to advance, harras and chase down their opponents: someting horse archers could probably do better than, say, reiters or dragoons. In Western Europe - not so much since short distances and larger armies often meant that a pitched field battle was much more likely to happen, and bows already started to fall out of fashion in those.
​
Sources:
The answer to this is that a ruler of a state, proto-state, or any political entity with the capacity to wage war, doesn't get to pick and choose what their army is equipped with like it's a strategy game: they take the culture they are a part of to war with them.
I've written about this before, in answer to question about the phalanx, but the essential elements remain the same: military action is an expression of the culture that wages it, and the culture is a complicated knot of philosophy, economics, production, population, geography, and history. It cannot be separated from that context. So if the culture your hypothetical ruler is a part of (and a ruler is itself an expression of that culture and subservient to it) means that they go to war with clubs and stones, then that's the army you got.
There was also no widespread system of comprehensive formalized training nearly anywhere in existence in the 17th century. Armies were made primarily of volunteers who served as employees of private military contractors who themselves were contracted by people with something to gain - not always militarily, politically, or economically - in military action. This all began to change around the 30 Years War because of pressures weighing on that system of raising and sustaining armies, but private armies were viable in part because of widespread cultures of armed public service that existed in western European polities.
With still leaves us with an implied question: why, if the bow was a superior weapon, were muskets or hand guns used instead? Well, one answer might be that guns were better weapons. Weapons aren't just how fast they can shoot or how much damage they can do, they are a system to themselves that are expressions of production, logistics, longevity, reliability, and maintenance. Using a bow was also not as easy or as powerful as it's often represented, but I'll leave that question to more interested responders. What you should know it that by the 17th century, gun production was a huge business in England and elsewhere, and even by the mid 16th century, most militia organizations that stipulated the use of a ranged weapon for their members would have specified a firearm, not a bow or crossbow. This reflects that organized communities of armed men, who all had a public responsibility to practice with their arms and use them in times of need, saw that firearms were useful weapons to own and to train with. Which further tells us that guns were supported by a network of various production efforts, form stockmaking and barrel-making, to lock-making, decoration, powder production and bullet production, to say nothing of the same production efforts that supported artillery as well.
The question of "why did the bow fall out of favor" can't be answered by looking at it as a question of a min-maxing state tyrant looking to optimize his army, but by looking at reasons that small-scale organizations, both public and private, saw the gun as a weapon of choice, because, again, you bring your culture to war with you, you don't create it at need, and the culture was what replaced the bow.
B. Ann Tlusty, The Martial Ethic in Early Modern Germany
John A. Lynn, Women, Armies, and Warfare in Early Modern Europe
Marion McNealy and Max Geisberg, Landsknechts on Campaign
David Parrott, The Business of War
Lois Schwoerer, Gun Culture in Early Modern England
For infantry? In the 1600s? Guns, all the way. In addition to what u/SgtBANZAI wrote in this thread, one needs to consider the fact that the bows and guns are essentially completely different weapons from the logistical perspective.
Although there is some truth that the training of an archer is more time-consuming that the training of the arquebusier, it is not completely true, or, to be more precise, it is true but the word 'training' is a misnomer. The actual process of training is not that different and it might be argued that the technological complexity makes the usage of the gunpowder weapons more difficult than the bows, especially given the fact that the any weapon of that kind used in 1600s i.e. one most likely fitted with some form of complex lock would have been one of the most if not the most advanced piece of technology most of the troops would ever see in their lifetime. Things like measuring the adequate amount of gunpowder are instinctive for us, but might not have been for the 17th century peasant. And this is on top of the intricacies of aiming and shooting that the guns share with bows and crossbows.
Now. the main problem with a bow is that from the perspective of physics, it is a simple spring, capable of releasing only as much power as it has been pulled with, usually less due to losses caused by friction, string fitting etc. In other words, the bow is only as 'strong' as the archer is. The bow does not have any armour-piercing capacity or even an acceptable range and strength to damage an unarmoured target. A strong bow does. But as I said above, a strong bow requires a strong archer too use and strength is not only built over the years but requires constant maintenance through exercise (not a problem in case of professional armies) and good diet (which was problematic, especially in case of large armies). Furthermore, physical damage (bone fractures, tendon strains) and illness could have severely and permanently influenced the strength and thus the capacity of an archer. Arquebusier or a musketeer (and to some extent, also a crossbowman) did not face these problems. As long as he was able to load the weapon, rise it, keep it steady and withstand the recoil, his ability to damage the enemy was not compromised.
So with the emergence of the large armies, increasing population, cooling of the climate in Europe and usage of the old agriculture methods, there were more and more soldiers, what was not offset by the adequate feeding of the general population and the soldier themselves. In such circumstances, it was easy enough to find thousands of people capable of firing a musket or holding a pike, but finding the same number of strong people able to consistently shoot arrows from a heavy longbow and keeping them in shape was far more difficult. Bows, as already noted by u/SgtBANZAI, were used throughout 17th and even 18th century (some formations, such as Bashkir cavalry in the Russian forces used it even in early 19th century), but they were common among Russian, Tatar, Polish and Lithuanian cavalrymen who were also commonly equipped with bows and firearms for increased versatility, making bow a specialized weapon, used in conjunction with corresponding tactics (and also for hunting in case of light cavalry moving without wagon train). But the gunpowder weapons became the only reasonable ranged weapon for slow-moving, numerous infantry.