Obviously all antibiotics haven’t same effect But we can guess the possible bacteria for certain antibiotics For example ciprofloxacin is right choice urinery tract and skin, amoxicillin klavulonic acid is for the upper respiratory system, cephalosporins are for lung etc
We do culture and sensitivity tests. It could be done with I believe any bodily fluid. So if someone has a urinary tract infection we send a sample to the lab and they do a C&S to determine the type of bacteria and which antibiotic is effective in killing that specific bacteria. Some bacteria are resistant to certain antibiotics, so not every antibiotic is going to kill every bacteria.
Of course not all antibiotics have same effect on bacteria due to the differences on mechanism of action. We can choose the correct antibiotic first by looking to the site of infection that give a good prediction about the type of bacteria, if getting confused or difficult to decide then move to culture. Some bacteria developed resistance against some antibiotic, to ensure that the drug will be effective do sensitivity test in culture.