Framed Roof Structure
Framed wood roof structures are typically constructed using joists or rafters. Joists are usually horizontal where rafters are sloped. Both are regularly spaced (16 inches is common). They may consist of logs, sawn or engineered lumber, glulam, solid timber, etc. Their size and spacing is determined by their unsupported length (span), their spacing, the expected roof load, etc.
In the case of flat roofs, these members are commonly called ‘joists’. Regularly spaced joists simply span across the building, often supported by perpendicular walls and usually supported by the exterior walls on opposite sides of the building. A flat roof framed with roof joists is often similar to a hand framed floor structure, except that it is obviously covered with a roof covering at the top of the building.
‘Rafters’ are essentially sloped roof joists. A pair of two rafters typically meet at the ridge, or peak of the roof. A ridge board is sometimes placed between the two opposing rafter tops, but not always. If a ridge board is present, it essentially acts as a pressure plate between the rafter pairs, and does not carry signficant gravity loads. The lower end of the rafter is usually directly supported by an exterior wall or beam.
Sloped rafter pairs lean against each other at the roof ridge. Thus, under gravity loads the roof, including the ridge, would move downward and outward over the walls. In other words, the rafter bottoms must be restrained in a horizontal direction, in addition to normal gravity (vertical) loading. This restraint is typically provided by rafter ties. These are continuous, horizontal tension members placed at or near the bottom of each or every other rafter pair. Rafter ties often double as ceiling joists.
If no tension members such as rafter ties are present, the wall or support structure must be capable (either through mass, bending capacity, or other restraint) of withstanding the lateral thrust imposed by rafters that are unsupported at the roof ridge. Historically, buttresses have been used to increase lateral capacity in the exterior walls of cathedrals and other buildings with open, sloped ceilings.
As the roof slope decreases, the outward lateral thrust imposed by the rafters increases. This is because the vertical component of the vector needed to support gravity loads is resolved by a longer horizontal component. For this reason, raftered roofs with lower pitches may require a ridge beam. This member, unlike a ridge board, supports gravity loads at the rafter tops and may eliminate horizontal thrust. Ridge beams obviously have to be sized and supported properly.
Collar ties are horizontal members placed higher up towards the ridge. They are intended to keep the ridge from separating under wind, or uplift loading when other provisions are not made to secure the rafter tops together. The rule of thumb is to place collar ties in the upper 1/3 of the roof height. However, higher placement improves the performance of collar ties.
Another primary component of a framed roof structure is the roof decking, or sheathing. This usually consists of plywood, OSB, or sawn lumber planks. The roof deck is usually fastened directly to the top of the the roof joists or rafters, although sometimes purlins are used. Purlins are placed on top of and perpendicular to the joists or rafters and sometimes directly support metal roof panels.
The following is a sketch of a common framed roof structure using rafters, post and beam. Roof decking is not shown:

The following is a sketch of a common hand framed roof structure using rafters and ridge board. The ceiling joists also act as rafter ties:

ADDITIONAL RESOURCES:
National Design Specification for Wood Construction
Timber Construction Manual
Laminated Timber Design Guide