Many spells and some non-magic attacks (such as explosives) have an area of effect. This is described on p.204 of the PH. Spells and other ranged attacks which require a "to hit" roll are covered by the interpretations the Ranged Attacks interpretation. Otherwise, area of effect applies to any creature in that area - both friend and foe.
Area of effects are superficially described on p.204 of the PH. More detailed:
Line: draw a line on the combat map from origin to target (or range as defined). Target is always the center of a square. If the line crosses a square, it is included in the area of effect. If it touches the corner of a square, it is NOT included.
Circle/Cylinder: draw a circle whose radius is equal to the range/size of the effect starting from the point of origin. Squares touched are included.
Cube: area of effect is always aligned to the combat grid, sized accordingly.
Sphere: Since the point of origin may be above ground level, the impact of the attack on the ground will vary by the height. The DM will determine the area of effect.
Xanathar's Guide to Everythying (XGE) has illustrations of Area of Effects as played on a square combat grid map.