The second way quality matters is that pages that rank high themselves carry more influence than those with low ranks. So getting an inbound link from a very popular site can help more than one from an unpopular site. Also how much benefit you gain from a link is dependent on how many other links are on that page. So being the only link on a page will garner more benefit than being one of one hundred links. I often compare this to sharing a pizza. If you have a pizza and share it with 2 people, each person will get more than if you shared it with 10 people. Also if the pizza is larger to begin with everyone will get more. So you'll get a larger benefit from being linked to from a page with a high rank and few links than from a page with a low rank and many links.
This brings me to another important issue. Many people operate under the impression that being in link farms, or FFA (Free-For-All Link Sites), which are basically pages filled with hundreds or thousands or unrelated off topic links, can hurt their ranking or get them banned. This is not true for two reasons. The first is an ethical reason, since a webmaster has no control over who links to them, no inbound link will ever penalize you. The second reason is that it is simply unnecessary to penalize people for doing this. A link farm will not have much weight to begin with, and since the rank is diluted by such large numbers, the benefit gained from such a link will be almost unnoticeable.
So while getting a large amount of incoming links is important, the weight and context of these links are what will a make a difference in your ranking.
The final thing you must know about how link popularity works has to do with redirects. Depending on the type of redirection used search engines will not assign any rank to the resulting page. So if people link to you using a long complicated affiliate URL, or vice versa, those links will not count. For the most part link popularity is tied to the URL, so to build a high link popularity you need all the links pointing to this same URL, not any variation or mirror of it. If you want to maintain search engine rankings you should try using a "301 Redirect." This type of redirect sends a special HTTP header to the client that should tell the search engines to apply the weight to the resulting page. This is important to remember even if you do not use redirects as www.example.com, example.com, www.example.com/index.html, and example.com/index.html are all the same page, and yet are 4 different URLs. So be sure you link to your internal pages the same way throughout your entire site. Google Webmaster Central does include a tool to handle a portion of this (whether or not to use "www") for you automatically.