How do airplanes get stacked in a holding pattern?
ATC has many tools "in their belt" to keep traffic separated. When things back up, it can get crowded. Emergencies and weather regularly cause disruptions and ATC handles them according to the circumstances.

To illustrate some possibilities, I will use Seattle as an example here. You can find the airport information here.

Most aircraft coming into the area will be commercial flights on IFR flight plans, and they will follow a Standard Terminal Arrival (STAR) into Seattle. You can find this seciton towards the bottom of the AirNav page. There are different STARs depending on the direction from which the flight is arriving. Each STAR will include published holding patterns.

Listed here is the direction of arrival, the name of the STAR, and the holding fixes:


East - EPHRATA - FLAAK, EPHRATA, ODESS
East - GLASR - LOSTT, TEMPL, JAKSN
Southeast - CHINS - SUNED, BRUKK
South - OLYMPIA - BTG, OLYMPIA
Southwest - HAWKZ - BTG, HAWKZ
Northwest - JAWBN - JAWBN
Northwest - MARNR - MARNR


As you can see, there are 11 different holding fixes across the seven STARs. If you have one aircraft from each direction, they can each hold at the fix according to their STAR. The busiest STARs have multiple holding fixes that may be used. Aircraft may also be stacked on the same hold at different altitudes. You can read some FAA information about holds here.

Aircraft may also choose to divert. Depending on how much fuel they have and how the weather/emergency is playing out, they may not want to hold indefinitely on the GLASR arrival at LOSTT. Generally ATC will not ask for a diversion unless absolutely necessary. Among others, Portland, Vancouver, and Spokane are all fairly close to where the aircraft may be holding and could be viable alternates.