I know that ERC-20 tokens are traded in pairs on the trading exchanges, but what essentially determines the price in USD? I would like to know if there's a specific algorithm that does the calculation. Any help would be appreciated.
There is no "specific algorithm". It's simply supply and demand. If more people want to buy the token, the demand goes up and price goes up.
Some tokens (try to) define their value internally in respect to ETH but mostly not. Also some tokens try to define their value based on external assets, such as fiat - some succeed better than others.
But mostly it's all based on supply and demad.