It is based on the percentage which is used to calculate a target (sometimes called a 'par score') that is usually a fractional number of runs. If the second team passes the target then the second team is taken to have won the match; if the match ends when the second team has exactly met (but not passed) the target (rounded down to the next integer) then the match is taken to be a tie.