A closet (especially in North American English usage) is an enclosed space, with a door, used for storage, particularly that of clothes. Fitted closets are built into the walls of the house so that they take up no apparent space in the room. Closets are often built under stairs, thereby using awkward space that would otherwise go unused.

A piece of furniture such as a cabinet or chest of drawers serves the same purpose of storage, but is not a closet, which is an architectural feature rather than a piece of furniture. A closet always has space for hanging, where a cupboard may consist only of shelves for folded garments. Wardrobe can refer to a free-standing piece of furniture (also known as an armoire), but according to the Oxford English Dictionary, a wardrobe can also be a "large cupboard or cabinet for storing clothes or other linen", including "built-in wardrobe, fitted wardrobe, walk-in wardrobe, etc."

Other uses of the word
In Elizabethan and Middle English, closet referred to a small private room, an inner sanctum within a far larger house, used for prayer, reading, or study. 

The use of "closet" for "toilet" dates back to 1662. In Indian English, this use continues. Related forms include earth closet and water closet (flush toilet). "Privy" meaning an outhouse derives from "private", making the connection with the Middle English use of "closet", above.

Types

Airing cupboard: A closet containing a water heater, with slatted shelves to allow air to circulate around the clothes or linen stored there. 
 Broom closet: A closet with top-to-bottom space used for storing cleaning items, like brooms, mops, vacuum cleaners, cleaning supplies, buckets, etc.
 Coat closet: A closet located near the front door. Usually used to store coats, jackets, hoodies, sweatshirts, gloves, hats, scarfs, sunglasses, and boots/shoes. This kind of closet sometimes has shelving. It only has a rod and some bottom space used for clothes stored in boxes or drawers. Some may have a top shelf for storage above the rod.
Custom closet: A closet that is made specifically to meet the needs of the user, like a kids closet.
 Linen-press or linen closet: A tall, narrow closet. Typically located in or near bathrooms and/or bedrooms, such a closet contains shelves used to hold items such as toiletries and linens, including towels, washcloths, or sheets.
Pantry: A closet or cabinet in a kitchen used for storing food, dishes, linens, and provisions. The closet may have shelves for putting food on.
 Spear closet: A closet made to use up otherwise unused space in a building.
Supply closet: A closet most commonly used for storing office supplies.
 Utility closet: A closet most commonly used for storing house appliances and cleaning supplies
 Walk-in closet: A storage room with enough space for someone to stand in it while accessing stored items. Larger ones used for clothes shade into dressing room.
 Wall closet: A closet in a bedroom that is built into the wall. It may be closed by curtains or folding doors, in which clothes can be stored folded on shelves.
 Wardrobe: A small closet used for storing clothes.

Closet tax question in colonial America
Though some sources claim that colonial American houses often lacked closets because of a "closet tax" imposed by the British crown, others argue that closets were absent in most houses simply because their residents had few possessions.

Closet organizers
Closet organizers are integrated shelving systems. Different materials have advantages and disadvantages:
 Wire shelving: Moderately difficult to install, wire shelves cannot hold much weight without giving in but are cheap.
 Wood shelving: Difficult to install, wood shelving is sturdier and more expensive than wire.
 Tube shelving: Easy to install, tube shelving involves few pieces and requires no cutting or measuring.

See also
Cubby-hole, one name for the cupboard under the stairs

References

Home
Cabinets (furniture)
Clothing containers
Rooms