Electron energy loss in simple metals and semiconductors