First of all, the concept of genetic modification needs to be understood. Proteins are coded for by genes in the DNA of an organism, with each gene coding for a different protein. We utilise the fact that different genes code for different proteins in genetic modification.
Some proteins have a very important role in humans, such as insulin, for example. Insulin is a hormone which signals for anabolic metabolism (the synthesising of biomolecules such as proteins and fats from their constituent parts - amino acids and fatty acids, respectively) and is deficient in Type 1 diabetes mellitus. This disease can be treated by injecting insulin after meals however this insulin needs to come from somewhere - and that's where the genetic modification of bacteria comes in.
Human DNA with a working insulin gene must be obtained, and then the insulin gene is 'cut out' using an enzyme called a restriction endonuclease. The same restriction endonuclease is then used to cut out a region of a plasmid; these are circular rings of DNA which are found in bacteria. Note that plasmids are not the same as circular chromosomes found in bacteria, which also contain DNA. When cutting, the restriction endonuclease leaves 'sticky ends' - this means that the DNA is not cut evenly and one chain of the DNA double helix has more bases than the other chain leaving an overhanging region. This helps with 'sticking' the new gene in.
We are now left with a human insulin gene and plamid with a gap and the same sticky ends as the insulin gene (as the same restriction endonuclease was used). The insulin gene is then inserted into the gap in the vector, and stuck in place by an enzyme called DNA ligase. To get the plasmid with the human insulin gene into a bacterium, a vector must be used. A vector is simply something which is able to transfer DNA into a cell and in this case, a virus can be used.
The bacterium now contains the plasmid with the human insulin gene and will produce the protein insulin. Becase of the rapid rate of reproduction in bacteria, more and more bacteria with the human insulin gene will be produced and this means a lot of human insulin being produced - this can be extracted and used to treat people with type 1 diabetes mellitus, as mentioned before.
Of course, human insulin is only one example of how bacteria can be genetically modified - there are many other proteins which humans have used bacteria to synthesise on mass. Erythropoetin (for treating anaemia) and growth hormone (for treating growth disorders) are more examples which can also be synthesised on mass by genetically modifying bacteria.