From About. com:

How Delegates are Awarded
The Democratic and Republican parties use different methods for determining how many delegates are awarded to, or “pledged” to vote for the various candidates at their national conventions.

Democrats use a proportional method. Each candidate is awarded a number of delegates in proportion to their support in the state caucuses or the number of primary votes they won.

For example, consider a state with 20 delegates at a democratic convention with three candidates. If candidate “A” received 70% of all caucus and primary votes, candidate “B” 20% and candidate “C” 10%, candidate “A” would get 14 delegates, candidate “B” would get 4 delegates and candidate “C” would get 2 delegates.

In the Republican Party, each state chooses either the proportional method or a “winner-take-all” method of awarding delegates. Under the winner-take-all method, the candidate getting the most votes from a state’s caucus or primary, gets all of that state’s delegates at the national convention.