For many of the common childhood bacterial infections that we treat with antibiotics, 24 hours of the antibiotic is enough to make sure the child is no longer contagious (able to spread the germ to others), but this is not true for all infections. Streptococcal infections (strep throat) and bacterial conjunctivitis are probably the two most common ones, and both require antibiotics for just 24 hours before a child can return to school without worrying that he will spread the infection to other children. However, pertussis (whooping cough) requires five days of antibiotics to make sure that it cannot be spread. Some intestinal infections and pneumonias (lung infections) can still be spread even after the child has finished the full course of antibiotics. Your local department of public health has printed guidelines that detail the recommendations for various types of infections.
The other factors to keep in mind when determining how soon a child should return to school are length of fever, energy level, and appetite. Even if a child has completed the appropriate amount of antibiotic to stop him from being contagious, the child may still have fever, act fatigued, or have a poor appetite. That would make him an unsuitable candidate for a full day of school. Staying at home for another day or two until he is up to full speed may be the best course of action.
Viral illnesses are actually more common and spread more readily than bacterial illness in school-aged kids. Colds and flus can wreak havoc on a classroom. There is no treatment that will make the viral illness go away sooner, and the viruses can remain in the nose and throat for days or weeks. We obviously can't keep kids at home for three weeks every time they get a cold, but a day or two when the nasal symptoms are at their peak is not a bad idea.
The bottom line is that good precautions in school and at home make sense. Frequent hand-washing by everyone, including the kids, is probably the most important thing that can be done to try to limit the spread of infection.