Digital marketing is a complicated subject and understanding how different kinds of links affect your SEO can be one of the more complicated aspects of that complicated subject. The point of this post is to help you understand the different kinds of links and how they can factor into where your content lands on any given SERP.
How links affect where your content may land on a SERP
A search engine uses a formula called PageRank to determine what content to display on their SERP and links are how PageRank is determined. Each link acts as a vote for the relevance and importance of a page. A link from a third party is much more valuable than an internal link and third party links are weighted by things like trust and relevance. A link from CNN or BBC will be weighted much higher than a link from another lesser known third party. An easy way to think of PageRank is a search engine's assumption of how important a page is to a user's query based on other sites that link to it.
The different types of links
Do-Follow vs No-Follow: In the past PageRank was determined merely by the number of links to a page. This led to the terrible practice of black-hat SEO flooding links in comment sections, Wikipedia articles and anywhere else they could sneak them in to improve the PageRank of whatever content they were trying to promote. This made it harder for search engines to find quality and relevant content to display on their SERPs by crawling the web.
In 2005 Google started the trend of setting the type attribute in an anchor element to "nofollow" to prevent that link from passing equity to PageRank. This practice gave webmasters the ability to remove incentive from using unethical ways to link content like spamming their site's comment sections with links and, according to Google, creates more relevant results for a user's search.
To summarize, anchor tags that have an attribute type of "nofollow" are passed over by search engine's crawlers when calculating PageRank for your content. That doesn't mean all "nofollow" links are bad because they can still result in more traffic, but you should strive for as many "dofollow" links as possible to rank higher in search engine results.
Internal vs External: External links are links from a third party while internal links are links poining at a page on the same domain. External links are weighted more favorably in calculating PageRank than internal links. There are tactics digital marketers can use to boost their external link count like broken link building but the best way to increase your external link count is creating quality, relevant content.
Internal links, while weighted less favorably, can still impact your PageRank so it is important to setup navigation on your site to take advantage of the way PageRank works. A simple formula for this is initial PageRank + (total ranking power / number of outbound links). If you have three pages, alpha, beta and charley, with an initial PageRank of 1 each, putting a link on page beta pointing at page alpha will give page alpha a PageRank of 2. If you were to add another link on page beta pointing at page charley page alpha's PageRank would fall from 2 to 1.5 but page charley's PageRank would increase from 1 to 1.5.
To summarize, external links are more valuable to your overall PageRank but there are ways to optimize internal links to give as much of a boost as possible. It is important to take steps to structure your internal links to get PageRank on pages that are going to lead to accomplishing goals or creating conversions.
How to know what works
Google's exact formula for determining PageRank isn't publicly available but there are tools to assist digital marketers in building solid SEO strategies. Moz offers great resources for benchmarking your success. Fortunately, Chartly has integrated with their API to easily gather your site's data and visualize it in comprehensive dashboards that offer a numeric readout on things like PageRank and link counts. Easily see what pages and site authors are creating PageRank and, ultimately, traffic for your web site.