On a square rigged vessel, it is the lowest and largest sail on the main mast.
On a fore-and-aft rigged vessel, it is the lowest and largest and often the only sail rigged aft of the main mast, and is controlled along its foot by a spar known as the boom. A sail rigged in this position without a boom is generally called a trysail, and is used in extremely heavy weather.
The modern Bermuda rig uses a triangular mainsail as the only sail aft of the mast, closely coordinated with a jib for sailing upwind. A large overlapping jib or genoa is often larger than the mainsail. In downwind conditions (with the wind behind the boat) a spinnaker replaces the jib.
Some mainsails are "full-batten" mainsails, meaning the batten extends all the way from the mast to the leach of a sail. A partial batten extends from the leech partway to the mast. Battens enable the mainsail to project farther away from the mast. However, there is some cost associated with the battens themselves, "batten pockets" need to be sewn into the sail, and "batten cars" may be needed to allow the sail to be raised and lowered.
Before Nathanael Greene Herreshoff's invention of sail tracks and slides in the 1880s, mainsails were limited in height. Traditional mainsails were held against the mast by hoops that went the full way around the mast. This meant a traditional mainsail could be raised no higher than the first point a rope or wire was required to keep the mast upright.