How do urine tests show the presence of pyelonephritis?

They don't . They show that the urine is infected but not whether that is in the kidney or just the bladder.
They don not. The urine test shows only infection. If you add fever and/or loin pain to urine infection you get pyelonephritis.