In the beginning of the פרשה, י"ז:ו, regarding the giving of capital punishment, the pasuk says "על פי שנים עדים...", that we require at least two witnesses. Later on, (י"ט:ט"ו), regarding monetary matters, it states "על פי שני עדים...", again that two witnesses are required. Although the words שנים and שני both seem to mean 2, there is still a difference between the two. What is the difference, and why is one used over the other in each instance?
נצי"ב writes, in העמק דבר, that שני means two identical objects whereas שנים doesn't mean 2, but rather a pair. In ירושלמי סנהדרין, quoted in the .רא"ש כ"ג, it says that if two witnesses give absolutely identical testimony, they must be investigated further for something is a little suspicious. It is told that the גר"א would disqualify witnesses who gave absolutely identical testimony based on a משנה in סנהדרין. Therefore, with regards to capital cases, since there is a requirement to deeply investigate the witnesses (דרישה וחקירה), it says שנים, because identical testimony is not accepted. But in monetary matters, where there is no requirement of דרישה וחקירה, it says שני, because they are allowed to be identical.
[I was once asked why when we count the omer we say שני שבועות or שני ימים instead of שבועיים or יומיים. I answered based on the above, that שבועיים or יומיים would mean a pair of weeks, or a pair of days and therefore, would not be a real counting of two and for the sfira, we require a genuine count.]
מהרי"ל דיסקין offers an alternate explanation. The word שנים means not only two, but two at the same time. Just as רגליים or ידים refers to a presence of two hands or feet, שנים means two together. Therefore, for capital matters, it says שנים because the two witnesses must be present together. Two witnesses who observe a capital crime, but don't see each other are not valid witnesses. This is referred to in the gemara as עדות מיוחדת. However, for monetary matters, עדות מיוחדת is still valid. So the תורה wrote שני instead of שנים over there.
ר' יעקב Kaminetzky, in אמת ליעקב offers yet another approach. He suggests that the proper wording would usually be שני עדים. However, the :גמרא סוטה ב teaches that the word עד by itself implies two witnesses - because only the testimony of two witnesses is valid - unless the תורה makes it clear that it means one. Therefore, I might have thought that שני עדים means that two groups of two witnesses are required to build a capital case. Therefore, the term שנים עדים is used, implying שנים שהם עדים, two individuals who are witnesses, to dispel any such notion. Then, once it is clear that capital cases do not require two groups but rather simply two individuals, it is obvious that no more is needed for monetary cases and so the conventional wording, שני עדים, is used.