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 obstacles are found (eg: trees), the algorithm try to get around it by moving around the edges. To do this, the unit is rotated a certain number of degrees (eg: 45) until it can move again. 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 are still obstacles). 

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

Once unit is back to the imaginary line-of-sight, it resume path finding from there. More obstacles 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