It is probably best not to ride at night but sometimes it is unavoidable.
As the days are getting shorter riding in the dark is going to become more likely. Especially if you stay late at work. In the dark months I can leave for work in the dark and ride home in the dark.
Wednesday night I went to an event after work with every intention of getting home before the sun drops but that just did not happen.
I have all my bikes equipped with good lighting. The front light is 500 Lumens and not only lets cars sees me but it is strong enough to illuminate road debris and hazards. The flashing red rear light is visible for over a mile during the day so it is very visible at night. These two lights are expensive but they keep you safe and that is worth it. There are many inexpensive versions available for under $20 and they are better then nothing but to be safe you need to spend about $70 to $100 for each of these lights.
Wearing some reflective gear is important too.
This year I have had to ride home in the dark 5 times. Once for a 10 mile country road ride. Each ride was uneventful and the cars along the way were very respectful.