Dynamic structure factor for the electron gas in metallic systems