Periodic solutions for second-order differential equations with a singular nonlinearity