Wooden sailing vessels, including ships, have several types of 'spars'. A mast is one type of spar and some vessels have only one mast, where others have up to seven.
The configuration of the sails can be broken down into two distinct types. Square rigged and fore-and-aft rigged.
A mast that is square rigged has one or more additional spars, called yards, set cross-wise to the mast. The term 'square rigged' isn't from the sails being square, it's from the yards being set at a 90 degree angle or square to the mast. Here's a photo showing a mast with 4 yards.
http://www.liirishfest.com/peter_on_jean...
Either end of a yard is called a yardarm, but some people call the entire yard a yardarm.
As you know, the sails are 'bent' (attached) to the yard and are rectangular in shape. Each yard has several lines attached to it to raise and lower it, pivot it about the mast, and control the tilt among other things. Each sail also has several lines for raising and lowering (furling and unfurling), reefing, (shortening) and sheeting, (controlling the sail).
Here's a shot of a ship with it's yards set at an angle:
http://www.lib.uchicago.edu/e/law/tall-s...
A vessel with a fore-and-aft rigged mast or masts has its sails running in the same direction as the centerline of the hull, instead of athwartship or crosswise.
A photo of a fore-and-after:
http://www.dezeen.com/wp-content/uploads...
The fore-and-aft sails are bent to the mast and usually have a spar called a boom at the foot or bottom of the sail. Some don't, and are called loose footed. Some fore-and-aft sails also have a spar at the head of the sail called a gaff, and are then called gaff rigged.
Photo of gaff rigged sails on a schooner:
http://www.libertyhospitalityofmaine.com...
Some vessels have masts that don't use any type of lines called stays or shrouds. These are unstayed masts. An unstayed mast has to be fairly short and stout to be strong enough to withstand the force of the wind on the sails.
If a mast is made as one long piece, it is called a pole mast. In the old days, a pole mast could only be as tall as the tallest tree they could find. It is also very difficult to hoist such a large mast and step it in the boat, so they started making masts in sections. The first section would be called the mast, the second section is the topmast, the third is the topgallant mast, fourth is the royal mast and so on.
Every mast has a name as well, the largest being the main mast. If there is a mast in front (forward) of the main mast, it's called the foremast. If there is a mast behind (aft) of the main mast, it's called the mizzen mast. Other aft masts might be the bonaventure, jigger or other names depending on the type of vessel.
The lower mast had it's foot or bottom end sitting on a 'step', which was normally a large block on the keel at the very bottom of the hull. When you 'step' a mast, it just means that you are putting the mast on its step or standing up the mast. Smaller boats are usually stored with their masts unstepped when not being used.
Most sailing vessels have masts that use lines to keep the mast from falling over or breaking due to the forces on them. The lines that keep the masts from falling left or right, (port or starboard), are called shrouds, and the lines keeping the mast from falling backward are forestays. Backstays keep the mast from falling forward.
Here's a diagram of a ship showing the shrouds in yellow and the backstays in reddish orange:
http://www.globalsecurity.org/military/s...
And another showing the forestays and other stays:
http://www.globalsecurity.org/military/s...
In a very strong wind or storm it is a matter of safety to reduce the amount of sail area. Every sail on the old sailing vessels could be reefed. Reefing is simply a way to make the sail smaller without completely furling or storing the sail. There are several types of reefing, but the older vessels and some newer ones use reef points on the sails to tie the sail to the yard or boom.
If a storm gets bad enough and the wind is extremely strong, then some or all of the sails may be completely furled and the yards lowered. Lowering the yards makes the vessel less top heavy and less likely to be blown down, or knocked over on its side. The yards might even be completely removed from the mast.
In a really bad storm, the captain might order the royal, topgallant, or even the topmasts to be housed. Housing the upper masts means to lower them straight down through the mast cap. Housing an upper mast lowers the mast by at least 75% of its length which is very useful for reducing weight aloft. If they are ordered to be struck, then they are completely removed and stowed on or below the weather deck. The less weight up high, the more weather a vessel can take without rolling over.
Here is a photo of a ship with it's topsmasts housed and all of her yards struck or removed except for her three topsail yards following a hurricane.
http://www.history.navy.mil/photos/image...
Here is another photo of a brig setting fore and main topsails, with her topgallant masts housed.
http://homepage.mac.com/captrustywildric...
Larger fore-and-aft rigged vessels, usually those that are gaff rigged, sometimes have topmasts. Various types of topsails are rigged to the topmast and it too can be housed or struck if necessary.
Here's a typical two masted gaff rigged schooner setting a main topsail, but with her fore topmast struck.
http://upload.wikimedia.org/wikipedia/co...
And one last photo showing just a few of the lines on a square rigged vessel.
http://www.galvestonhistory.org/ElissaPh...
I hope this helped!