The border follows the crest of the Bitterroot Mountain range/the continental divide.
This link has some interesting history on the surveying and geography: http://history.idaho.gov/sites/default/files/uploads/reference-series/0156.pdf