The usual disclaimer: I am not a lawyer. And this stuff is not simple (when it comes to lawyers, nothing is simple )
The major watershed is whether it is a commercial (advertisement) use of a photograph or not. The risk of copyright or trademark infringement is much higher for commercial use than for editorial or fine art use. However, even in the area of stock photography for commercial purposes, the risk (that you might be sued) can be classified as high, medium or low. A good primer is on my stock agency's (ImageBrief) blog:
Part I: Copyright Law
Part II: Trademarks
The bottom line is, while in this country (and many others) anyone can take you to court for anything (and thus expose you to legal costs even if you win the case), the reasonable thing to do is to asses the risk.
For instance, the Bean sculpture in the Chicago Millennium park is copyrighted, yet millions of tourists are snapping that picture every day and posting it on social media, etc. While technically it is a copyright infringement, it is highly unlikely that the sculptor is going to take them to court. However, he did take to court larger corporations when they tried to use it commercially.