In The Sims, a roof would automatically be generated when an area enclosed by walls was open at the top. Players could select a roof pitch and roof texture, which would be applied to all buildings on the lot. Roofs in The Sims are mostly aesthetic, since there is no weather in the game.
The Sims 2
In The Sims 2, there are several types of roof to choose from. The base game has hip, gable, 3-Hip and Half-Hip roofs, and flat roofs. Other expansions add domes, cones, octagons, pagoda-style roofs, and mansard roofs. All of these, except for the mansard roof, are available in the Roof section of Build mode. Mansard roofs are made by using pieces found in the Architecture section. Flat roofs use flooring.
Roof pitch for non-flat or mansard roofs is set at 45 degrees, but can be adjusted to between 15 and 75 degrees using the roofslopeangle cheat (if The Sims 2: Nightlife or a later expansion is installed).
Roofs are particularly important in The Sims 2: Seasons, as they keep the elements out.
The Sims 3
The Sims 3 re-introduces auto-roofing, though it can be disabled. The roof tool in The Sims 3 mostly expands on the roofing options from The Sims 2, and allows the adjustment of roof pitch without the use of a cheat, a feature previously available in The Sims; The Sims 3: Ambitions (as well as an update for the base game)  allow the adjustment of pitch of individual roof segments. The Sims 3: World Adventures allows a roof type with pagoda-style eaves. Roofs in The Sims 3, are not necessary for the functionality of a building as there is no weather in the game - unless The Sims 3: Seasons is installed.