Before there were underground imaging technology, how did people know where to direct a mine tunnel? Presumably people knew from the kind of rock on the face of a mountain whether it contains veins of ore, but how would you decide where to tunnel to? Do they just explore? How do they know when the mine is exhausted? Why not just keep tunnelling until you find more ore?
While I can't speak to the middle ages specifically, Pliny the Elder suggests that gold mining in the first century CE did involve randomly tunneling when seeking deposits at depth:
The miners gaze as conquerors upon the collapse of Nature. And nevertheless even now there is no gold so far, nor did they positively know there was any when they began to dig; the mere hope of obtaining their coveted object was a sufficient inducement for encountering such great dangers and expenses.
(Emphasis mine, from Natural History book 33, volume 9 page 57 of Rackham's 1938 translation.)
General placement of a mine would indeed be guided by surrounding geology (page 53):
People seeking for gold begin by getting up segullum -- that is the name for earth that indicates the presence of gold. This is a pocket of sand, which is washed, and from the sediment left an estimate of the vein is made.
Though Pliny does not detail the method of locating a silver deposit, he does state it is only found in deep shafts (p. 73) and describes a number of other minerals found in the same mines. Similarly, copper and iron are described in terms of the geology in which they may be found and are said to be found both on the surface and at depth, but both in easily-identified ores (book 34; p. 215, 233).
Andrew Wilson (p. 17) states that hydraulic mining of surface deposits was much more common than shaft mining and refers to Pliny's statements, where water would be collected or redirected over areas known to contain deposits to expose ore at the surface or in runoff. Wilson also estimates that the scale of Roman mining was unmatched until the industrial revolution (p. 26), which may suggest similar techniques were used through the entire period up to the development of mechanized mining.
Interestingly, Wilson also observes that Roman industrial-scale mining generally ceased around the third century CE, possibly due to the immense cost of constructing infrastructure for hydraulic mining. Given suitable construction capability, hydraulic mining might have been more common throughout the intervening time.
Gold was easier to spot in those times
I live in New Zealand, and in the old days gold nuggets were found in shallow rivers/streams and washed up on beaches in gold hotspots.
There were even annual events for who can collect those most gold off the beach in one day.
So miners would simply walk around the hills, and look in the streams, and when there's a little gold, that's an indication that there's more around.