In the simplest terms, search engines view a link to your website like a vote: If another site links to yours, it must think your site is valuable. Each link to your site contributes a little bit of value to search engine algorithms, which can help boost your site's ranking in search results.
Search engines can tell the difference between real links and links created simply to make another site look good. (In other words, it doesn't work to ask friends to fill their web pages with dozens of links to your site.) Search engines also evaluate the relevance of the links: Does the linking site have a common theme with yours? Is it a popular site itself? Quality links make a difference.
Legitimate links to your site can also help boost traffic, for the simple reason that more potential customers are exposed to your site.