1st rule... if it's a free link that everyone can get it's usually a bad link because google hates link builders so every site that can give you a link for free google devalues (usually, like I said, because there might be exceptions)
2nd rule... if the link is not free, then you need to do a lot of analysis to figure out whether the link is good or not, and the analysis includes checking all of these things:
2a) quality of the website giving you the link (if the link comes from big brands like CBS, Cosmopolitan, Entrepreneur, Samsung, etc it's usually a good link as long as - like I said previously - it's not free, because many of these websites could have forums or allow comments on their articles and the forums / articles of these big brands can be accessed by everyone, so backlinks coming from there are not quality links in general. They still carry the trust that comes with these big brands, but in terms of ranking power they don't help too much. Now, if you - somehow - manage to get a link from within an article posted as a level 1-2 URL... now that's gold, even if the link is nofollow)
And speaking of nofollow links...
2b) if the links are nofollow they are useless for ranking. You can still get nofollow links for diversity purposes (having only d0follow backlinks pointing to your site tells google that you're a link builder - because only link builders chase after d0follow links because only they understand the power of these links - and google can hardly wait to punish link builders, so having nofollow links in your backlinks profile is a good thing... and if those links are provided by big brands like I mentioned at point 2a then that's even better because, even though nofollow links don't pass ranking power / link juice over to your site, they do help with making your site most trustworthy to google, and trustworthy sites usually get better rankings than sites that google doesn't trust)
2c) if the site giving you the link is not a big brand, or is obscure / unknown / not highly traffic'd then you need to at least make sure that it's not a link farm. Link farms are sites that are created specifically to sell links to naive and SEO newbies by having inflated metrics (DA / DR) but no traffic, no good content, no rankings, they might not even be indexed in google. So, if you find "great" linking opportunity for $10 from a site with DR 50+ that has no traffic, no / very few rankings, no / few indexed pages, etc... then you can be sure that this site is a link farm and it's one of the reasons for which this "great" backlink only cost you $10.
And speaking of link farms, another way to check if a site is a link farm is by checking their content for OBLs (Outbound Links). More specifically, if the owner of that site links out to other sites like yours from each article on their site then it's definitely a link farm (site created to sell links), and such sites don't last for very long in google, usually, so the links you get from these sites are low value initially (when the site is relatively new and not punished by google yet), and zero value eventually (after google detects them as link farms and de-ranks / de-indexes them).
Link farms usually have links to sites like yours in every article that they publish, while legit sites usually link out to sites like yours every 10-20 articles (just a rough estimate, I don't think there's a fixed number that tells you if a site is legit or not, but in general, you want 9 articles out of 10 to have no links to meaningless sites, only to good, established sites, while the 10th article can link out to small / meaningless sites).
There are probably more checks that could be done to ensure the links are of quality, but I can't remember them at the moment. Just do a google search for what constitutes a quality backlink and I'm sure you'll be able to find a good explanation
