Bottom Bracket
The bottom bracket (BB) is an assembly that contains bearings and sometimes the axle that the cranks attach to. The bottom bracket shell is the part of the frame holding the bottom bracket. The bearings often have seals to keep dirt out.
Threaded bottom brackets
Traditional bottom brackets screw into the bottom bracket shell. BB axles/spindles for threaded bottom brackets can be square tapered (in two standards, the more common Japanese International Standard and ISO, used by Campagnolo and a minority of manufacturers) or oversized (Shimano Hollowtech or International Spline Interface Standard, or ISIS). Generally, the oversized spindles were stiffer due to being larger, but had smaller bearings and may have had poorer bearing life. The crankarms were then fixed on to each side of the axle with retaining bolts. In older threaded systems, the bottom bracket contains the crank axle.
External bottom bracket cups came into play in the early 2000s. Here, the bottom bracket assembly contains only the bearings, and the crank axle is attached to one or both crankarms. The axle goes through the bottom bracket.
Among bikes with threaded BBs, the majority conform to the English standard. Many Italian frames used the Italian standard. A modern oversized standard called T47 is seeing increased adoption. This has an internal diameter of 46mm (compared to the 35mm diameter of the British standard).
On most threaded BBs, the bearings are not accessible for maintenance. Users will frequently discard them when they are worn out. It is possible for users to damage the threads when installing BBs, e.g. by forcing a BB in at an angle. A bike store can chase the threads to attempt to restore them. If the threads are beyond repair, it is possible to ream and re-tap a British threaded BB to the Italian BB standard, because the latter has a slightly larger diameter (36mm vs 35mm for BSA). This will have to be done cautiously, and not all shops will have the necessary tools. Also, Italian BBs are right hand threaded on both sides, so the drive-side cup may unscrew as you pedal.
Press-fit bottom brackets
Later, various press-fit bottom bracket standards were developed where the frame contains a molded seat for bearing cups. It is not possible to cut threads into carbon fiber. The alternative to press fit involves bonding a threaded alloy sleeve into the frame, and press fit is simpler and lighter. In some press-fit arrangements, most notably Trek's older BB90 standard, the cartridge bearings sit directly on the BB shell itself, rather than in cups that are pressed into the shell. (NB: Trek appears to be phasing this standard out at the time of writing.)
There are numerous standards for press-fit bottom brackets. Cups for one standard are not interchangeable with a different standard. However, for each press fit BB standard, manufacturers will make cups to accept most or all cranksets on the market. Examples of open standards include BB86 and Press Fit 30. Some larger bike manufacturers have BB standards proprietary to their own frames, such as Cervelo, Cannondale, and in the past, Trek.
Selecting a Bottom Bracket
Generally, users looking to install a BB and crankset from scratch would determine the frame's BB standard, then find a bottom bracket in that standard that matches their desired crankset axle type and diameter. On many press-fit BBs, users or bike stores can service worn bearings (i.e. clean and re-grease them) without replacing the cups, or extract the bearings from the cups. Naturally, the cups themselves can be replaced. Creaking is a known problem with press-fit BBs, and it is caused if the BB shell was manufactured out of specification (or if the shell got enlarged over time from a loose-fitting BB).
Current generation cranks can have axles ranging from 24mm (Shimano) to 30mm (so-called BB30 cranks). Any crank can be mounted on a bike with any bottom bracket shell type. Some companies even make bottom brackets for older (e.g. BSA) threaded shells and 30mm axles.
Also note that there are eccentric bottom brackets, which are really a bottom bracket that goes inside of an offset bottom bracket shell that fits inside the frame's bottom bracket shell. This allows the bottom bracket to be moved a bit, to tension the chain on a single-speed or fixed-gear bike.