Submitted by Joseph Canale, La Crescenta.
Answered by Dave Stevenson, George Van Osdol Professor of Planetary Science, Caltech.
The sun provides more than just energy, it provides the gravitational force that keeps us in orbit. But I interpret the question to mean "What if the sun stopped shining?"
In that situation, Earth's surface would cool down to a state in which the outgoing infrared radiation is balanced only by conductive heat from Earth's interior. The heat content of the atmosphere is negligible except on the very short time scale of a few days.
Within days to a week, Earth's surface would cool to below the freezing point of salty water, and the oceans would begin to form a complete ice cap. In a year or so the temperature would be down below 200 degrees absolute at the surface (that's roughly minus 100 Fahrenheit). The water in the deepest part of Earth's oceans would freeze after 1,000 years. Earth's surface would not cool all the way to its new stable state of around 30 degrees absolute (approaching minus 400 Fahrenheit) until millions of years had elapsed.
This state is one in which the radioactive heat in Earth's interior balances outgoing radiation. In the interim period of several million years, Earth's subsurface would be kept warm because of the slowness of heat conduction through solid rock or ice. So the inside would stay warm even as Earth's atmosphere was freezing out as solid oxygen and nitrogen. Interestingly, this means that bacteria that live well beneath Earth's surface might survive for a while, though life right at Earth's surface would be extinguished very rapidly on a time scale of years or less. A small number of people could survive a long time by drilling and creating a habitat deep down (miles below Earth's surface).