Calculate the combined total of the live load and dead load on the beam. Dead loads are weight components such as building materials (e.g., plywood, shingles or drywall). Live loads (in the case of a roof, for example) are variables such as wind loads, snow or other weather expectations, or structures on the roof itself, such as a chimney.
Add in point loads such as additional weight from other parts of the roof or walls anchored to the beam.
Find the maximum bend moment of the beam in question. Different beams have different bend moments, depending on whether they are made from wood, composite or layered wood, steel or another material. The maximum bend moment is when a beam has hit its capacity to bear the load before bending.
Consult a load span chart to calculate the length of the span, the weight loads and the material to determine the size of beam to use. There are calculators on the Internet that you can plug information into, and building supply or engineering firms have charts to give a reference to this. A qualified, experienced engineer can make these calculations and also take into account any other factors that may not be obvious to a layperson.