Orbital periods can be hours to 1000's of years. If we know T and a, we can measure the sum of the masses. We can often measure T directly, and a can be estimated from the velocities or the separations. The mass ratio is needed to determine the individual masses. Systematic trends are seen on the main sequence.
Hot stars are more massive.
Giants are less obvious, although supergiants have masses greater than 5M o . White Dwarfs have masses of 0.5 to 1.2M o . Most stellar evolution occurs over timescales which are much longer than human experience, so models are needed to determine how stars change. Stellar evolution is driven by the fight against gravity. At different stages different forces hold the star up.