James 1:3 is a short verse (in order to form the complete sentence, I've included verse 2 as well):
2. My brethren, count it all joy when ye fall into divers temptations;
3. Knowing this, that the trying of your faith worketh patience.
I find it interesting that James mentions it is the trying of our faith that "worketh patience," and not the trying of our strength, or talents, or intelligence.
As my faith is tried, ultimately I receive the reward for remaining faithful. This helps to increase my faith, so that next time my faith is tried, I know that by patiently remaining faithful, I will see the promised blessings.
A trial of any sort requires patience, but perhaps the best way to gain patience is by exercising faith.