In a heads up game, if someone bets and you call, you paid to see their cards and they have to show them to you. You do not have to show your hand if you don’t beat them and typically should not as it gives the other players information.
Your competitor can request that you show but doing so on a frequent basis is not encouraged. In fact some card rooms do not permit it.
In a multi-handed showdown usually the last player to take action by either betting or raising is the first to show the hand. In the case where everyone checks (or is all-in) on the last round of betting, then the first player to the left of the dealer button is the first to show their hand.