Different infections are caused by different bacteria and different antibiotics have varying mechanisms of action. For example some antibiotics target the cell wall of bacteria and that would be no use for a Gram negative bacteria such as Chlamydia or E. coli.
But some areas of the body can be affected by the same bacteria as other areas so those antibiotics will work on both areas. And some antibiotics are broad spectrum so can work against lots of different types of bacteria so it depends.
Yup, as PP have said you need specific antibiotics depending on what type of bacteria it is. There's also issues with some antibiotics getting to the right therapeutic levels in the right area.
So like if you have a UTI, antibiotic A reaches high levels in your urine so can be used, but if the same bacteria is giving you an ear infection then a different antibiotic may be used as drug A doesn't get to a high enough level in your ear to be effective. Joint infections are notoriously difficult to treat due to poor blood flow to the area, and some antibiotics don't pass through the blood-brain barrier to treat meningitis say.
As above. DD once had recurring ear infections. After the third time taking a broad spectrum antibiotic, the GP took a swab. Turned that particular strain of infection was resistant to the antibiotic she’d been taken so was prescribed a specific one. Never had an ear infection again.