I agree with other answers that the A* algorithm (or variants) is used often, but in some old RTS games (eg: Command & Conquer / Warcraft 1) a simpler and faster approach is used.

It works this way : 
project an imaginary line-of-sight from the unit position to its destination.
Most of the time, there is no obstacle between unit and target, and it can stop there since it already found the closest path.

If an obstacle is found (eg: some trees), the algorithm try to get around it by moving around the edges. It check two paths : left and right path (depending unit orientation when obstacle is encountered) and it take the shortest one. While moving around the edges, it try to move back towards the imaginary line-of-sight (which might not be possible because there is still an obstacle).

[![enter image description here][1]][1]

Once unit is back to the imaginary line-of-sight, it resume path finding from there. Another obstacle might be encountered and so on. It stops once target is reached.

It can result in a suboptimal path but on the other hand, it's really cheap to compute. In some extreme cases, unit might get lost (no path was found while there is at least one).

[![enter image description here][2]][2]

(from Warcraft 1 : peasant has to backtrack, resulting in suboptimal path)

Sources : 
- Command & Conquer [https://github.com/electronicarts/CnC_Remastered_Collection][3]
- Warcraft 1 : personal research


  [1]: https://i.sstatic.net/eghwb.png
  [2]: https://i.sstatic.net/HCVdh.gif
  [3]: https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/FINDPATH.CPP#L432