With great difficulty. Bacteria are incredibly good at surviving many different environmental and chemical strains.
Take antibiotics for example. Antibiotics work by stopping key roles in the bacterial cell that allows it to grow and reproduce (maybe effect DNA replication or the strength of the cell wall). However, when people do not take a full prescription of antibiotics as they think they feel better again they are actually giving the bacteria a chance to mutate so that they are no longer killed by the antibiotic. In effect we are selecting for the strongest bacteria that can survive the antibiotic. There are many survival mechanism the bacteria could use (e.g. make a pump to remove the antibiotic from the cell or altering proteins so the antibiotic no longer binds to them). This population of antibiotic resistant bacteria will then spread as they can now live in antibiotic conditions that others cannot. Over a number of years you will find that these antibiotic resistant bacteria become the norm.
To get round this you can either create new antibiotics, which is possible although difficult. Last year a new type of antibiotic was discovered in marine life that has been shown to kill MRSA. We then just have to hope that this antibiotic is used properly otherwise in the future it too will become useless.
Or there is the possibility of using bacteriophage. These are viruses that specifically target bacteria (much like how a cold acts on us). The phage enter a specific bacterial cell and kill it.
This is really good question, and Peter makes really good points about using antibiotics and bacteriophage. However, I want to make the point that not all bacteria are bad and need to be beaten. Even when we’re not ill, there are far more microbes on and in our bodies, than there are human cells! A large part of these are bacteria that are harmless to us, and can even help keep us healthy. These are known as ‘good’ bacteria.
One of the best examples I can think of showing the importance of good bacteria is Clostridium difficile. This is a bacteria which will quite happily live in the gut in small amounts with no problems. However, antibiotics for another infection (say, an ear infection) can kill off the protective good bacteria in the gut, allowing the C. difficile to take over and cause really severe disease.
In some ways most bacteria are easy to beat. Heating them up to high temperatures kills them and bleach kills off nearly all bacteria. The problem is, is that we can’t simply heat people up or give them bleach when they are ill because that would kill them as well as the bacteria.
Peter has made some good points about how we selectively beat bacteria without harming ourselves. Also – as Bethany has pointed out – some bacteria don’t need beating.