so do they discontinue pins and they then gain value?
Yes and no. Most of the pins available in the stores are what is called open edition. Meaning they will make then as long as they want. Be it a year, a decade, or just until it stops selling. They also sell limited edition pins that are capped at a set number, be it 100, or even up to about 10,000. Open edition pins tend to be more generic pins, while limited edition pins tend to be specific holidays or events. Since the limited edition pins are limited in number, there is a chance that they will increase in value. Open edition pins may also increase, however that increase is much, much smaller. Cast members may have pins on their lanyards that are not for sale, and can only be found through a trade.
The value of pins is highly subjective. You said that you liked pirate pins. Well, if you see someone with a limited edition, or just plain discontinued pirate pin, you may be willing to trade another hard to find pin from say Haunted Mansion (their favorite attraction).
Cast members cannot say no to a trade with a few small exceptions. CM's with green lanyards are for kids only, so they should refuse all adult traders. Also, they cannot trade for a pin they already have on their lanyard. Lastly, the pin must be an official Disney pin. Now most cast members have no idea what pins are official or not seeing how Disney releases at least 60 - 100 pins a month, and look for the pin trading logo on the back. Other guests can indeed say no to a trade. In the above example, if you offer the mansion fan an open edition mansion pin in exchange for a 250 piece limited edition pirates pin, they may refuse knowing that they can walk into the store and buy that same pin. Or, they may decide to take the trade since they don't like pirates that much. It is subjective to the people trading.
The whole trading aspect is to trade and get the pins YOU like for YOUR collection and really not worry about what pins will be worth more in the future. A few pointers before you decide to start trading. Check out pinpics dot com and dizpins dot com. They are both great resources. Look to see what pins you like, and what pins are hard to get. That way if you do end up with a great hard to find pin, a shark won't take it from you for an open edition pin. (Sharks are "professional" type pin traders that do buy quantities of rarer pins and then sell them on ebay. They like to take advantage of people who aren't very knowledgeable about the pins they have) Buying some traders for cheap on ebay is a good way to get started, but be wary. Sedesma pins aren't eligible to be traded. Also look for pins that are being sold in large numbers. There is a good chance if lots of people are selling a pin, that most cast members will already have that pin. Example, there is a set of "Cute" character head pins. The set breaks down to like 2 or 3 bucks a pin instead of 6-12 so lots of people bought the set and then break it up and trade them individually. So now most cast members had at least 1 of characters on their lanyards last time I was there.
Do it for the ones you like, and pin trading can indeed be alot of fun.