Rome is overall a fairly safe city, but like everywhere else, there are areas where you should be more careful at night. The biggest problems typically happen in certain neighborhoods: Around the main train station Termini, at night it's an area where lots of sketchy people hang around - you shouldn't linger there late in the evening. It's similar in parts of San Lorenzo, especially if you're out alone. The areas south of the old town, for example around Largo di Torre Argentina at night, can feel unpleasant too. Testaccio can also be a bit rough at night, especially when there's a lot going on and the bars are overflowing.
Most tourist areas are actually totally fine at night - the center around the Colosseum, the Spanish Steps, the Pantheon, or the Trevi Fountain are brightly lit and there are still plenty of other people around. Walking along the Tiber is normally no problem. Generally I'd say: avoid going alone at night into unfamiliar side streets away from the main routes, no matter which neighborhood. Take the metro or a taxi if it gets late and you'd have to walk longer distances. The usual precautions help - don't flash expensive stuff around, keep an eye on your bag, stay with other tourists if possible. With a bit of common sense you'll get through it safely.