When you are setting up your LinkedIn profile, there is a little ticker to the right that tells you how ‘complete’ your profile is. In order to reach 100%, you are supposed to procure recommendations. Now to get these recommendations it may be tempting to ask anybody and everybody you are connected to for one.
Really, though, this is a case where quality is far better than quantity. You want recommendations written by people who have worked with you in some capacity, people who can give specifics.
If you are having trouble gathering recommendations, try to think of people you can legitimately recommend, who can also recommend you back. For example, if you worked successfully on a project with a person, you might be able to recommend them based on their contributions, and they can recommend you as well. If you spontaneously write them a recommendation, when they receive it, they will be given the option to return the favor. Chances are, they will.