T-beams are generally preferred to rectangular beams and L-beams.
First of all, it performs better in bending since it has a higher second moment of inertia. The compressive load on the slab is shared by the flange of the T-beam (because it is cast monolithically with the slab), which increases the moment of resistance. This also reduces the need for additional compression reinforcement at the top. Rectangular beams are only singly reinforced in our textbooks. In practice, rectangular beams have to be reinforced doubly. Still, T-beams don’t need to.
The flange is more effective in bending and providing ductility. The web is more effective in shear. If you look at the stress distribution diagram of a T-beam, you’ll see that the bending stress is distributed more in the flange and shear stress more on the web. Hence, the resulting bending+shear is lower for any cross-section than in rectangular beams, where the two add up.
Due to the above two points, deflection is significantly reduced in the case of T-beams.
Also, we know that the concrete below the neutral axis is hardly contributing to the beam strength since it’s in tension. So why not remove it? The moment of resistance will be comparable for a rectangular beam and a T-beam with the same depth. Hence, T-beams are always more economical than rectangular beams. In fact, it is the least expensive among the common beam shapes except for box girders used in bridge decks.
T-beams have a lesser volume of concrete. Also, they reduce the floor to floor height since the flange is already part of the slab. These two things in combination significantly reduce the concrete required for the building, cutting down both cost and dead weight.
Lastly, T-beams are more convenient for pre-fabrication buildings.