I’ve seen it work different ways: winner-take-all,
winner-take-all by congressional district,
proportional representation with a threshold (usually 20%)...maybe there’s a website that explains each state’s allocation method.
Here’s a website that explains delegate allocation:
http://www.rhodescook.com/analysis/presidential_primaries/national/delegateallocate.html
There are others as well...