A stay is a piece of rope or wire that supports the mast forward, to prevent it from falling backwards. In the 16th century it was discovered that you could set a triangular sail on such a stay, and this turned out to be an important breakthrough in the development of sailing ships. Soon every sailing ship carried staysails on every possible stay, and still today staysails are in use on every kind of sailing vessel, from small sloops to full-rigged ships.
A staysail has three corners; the highest one is called the head, the lowest one is the tack, and the remaining one is the clew. The edge that is bent to the stay is called the luff, the bottom edge is called the foot, and the remaining edge is the leech.
The sail is set by hoisting it up along the stay by hauling the halyard that is fastened to the head. The sail is then trimmed for the current winds by adjusting the sheet that is attached to the clew. To take in the sail you haul the downhaul, that is usually fastened in the clew and runs through the head and down to the deck along the stay. This way the clew is pulled up to the head and they are then pulled down together.
A staysail is a fore-and-aft sail since it can take the wind from both sides of the sail, as opposed to the square sail.