The younger a child is, the harder it is to know how serious an illness is. Both viral and bacterial infections can make very young children quite ill, so with infants it's best to be proactive and to follow your instincts: If your baby is listless, eating poorly, or just doesn't look "right" to you, call your doctor.
Any fever in a baby less than one month old is worrisome, and you should call your doctor immediately.
For older children, things are a little easier. In general, viruses causing lower fevers (less than 102.5º) are accompanied by symptoms such as a runny nose, hoarseness, vomiting, or diarrhea, and improve over three or four days.
The illness is more likely to be bacterial if the fever is high, if it lasts longer than four days, of if there is specific pain (like a sore throat or an earache).
Note that antibiotics don't work on viruses, only on bacterial infections. We have a huge problem with drug resistance because of the overuse of antibiotics, so you don’t want to use them unless they will really do some good.
For a virus, keep your child comfortable and hydrated and wait it out. Most viruses are at their worst for three to four days, so if it lasts longer, or if the fever is 103° or higher, go to the doctor.