Disappointed that your local Sears, Kmart or Macy's store is one of more than 200 that's about to go dark? Take heart in knowing that for retailers, these decisions aren't easy. When major chains evaluate which of their locations they'll shutter, it isn't as simple as looking at each shop's sales and profitability. While those factors no doubt play a role — especially for financially strapped companies like Sears — several other considerations come into play. They include the ripple effects a wave of closures could have on the brand's reputation; how much in online sales the company could lose by exiting a market; and whether it has neighboring stores that could help it preserve some of those revenues. The math gets even more complicated for retailers that own a large chunk of their real estate — namely, department stores. For those struggling companies, which are losing share to off-price competitors and the internet, it is sometimes more lucrative to sell off a store that is profitable. "It's a complicated algorithm that doesn't just stop at, 'Are we making money at this store or not?'" Jim Sullivan, president of the advisory and consulting group at Green Street Advisors, told CNBC. "For each retailer, how that algorithm is shaped is different."

Where to start

Looking at the performance of individual locations is a good place to start, especially for retailers with a slew of underperforming stores. Sears, for example, said the 150 Sears and Kmart locations it plans to close are not profitable. While they rang in $1.2 billion in revenue over the past 12 months, they also generated an adjusted loss of $60 million. The strategy is a bit different at Macy's, which is still profitable. That chain said the 68 locations it marked for closure were either "unproductive" or, due to competition and changing consumer demographics, were "no longer robust shopping destinations." But because online sales typically fall in markets where retailers close a store, the company also had to analyze markets where it had overlapping locations. That way, it would have a better chance of picking up lost sales. This is a strategy that retailers across the industry are employing. Lack of a physical presence makes it difficult for consumers to return unwanted items ordered online and can cause them to shop at a competing store. It also reduces brand awareness. An analysis by CoStar, a commercial real estate research firm, found that two-thirds of the Macy's stores set to close were in quality "A" or "B" malls. However, 60 percent of them were within 10 miles of another Macy's. One example is in the Boston area, where Macy's is closing its Westgate Mall location. Its South Shore Plaza shop, some nine miles away, will stay open. "It seems that in most cases, Macy's is closing the store at the weaker mall and keeping open the store at the more dominant center [in the same market]," Suzanne Mulvee, CoStar's director of research and a real estate strategist, told CNBC. Mulvee noted that there are another 44 pairs of Macy's stores within 10 miles of each other, which could be the source of additional future closures. Meanwhile, 11 percent of the chain's remaining stores are in "C" malls, which puts them at risk as well, she said. "What we're likely going to feel over the next six to 12 months is ... even more pullback in secondary and tertiary markets," said Naveen Jaggi, president of JLL's retail brokerage.

Customers search for appliance bargains at the soon to be closing Sears store in the New York borough of the Bronx. Richard Levine | Corbis | Getty Images

For both Sears and Macy's, which own a portion of their real estate, offloading valuable properties can also be a way to make money off their vast physical footprints. Since the end of the third quarter, Macy's sold its flagships in San Francisco and Portland, Oregon, for a total of $95 million in cash. These types of strategies will be a crucial part of legacy retailers' real estate strategies moving forward. They're also a marked change from when these companies were building their brands, and relied on store expansion to increase their sales.

"The management teams at most retailers came up through the operational ranks, and they were not trained to think of real estate as a financial asset," Green Street's Sullivan said.

A love mismatch

One of the biggest hurdles struggling retailers face when deciding which stores to shutter is the mismatch they face with property owners. While they want to keep their stores open at the highest-quality properties, those landlords know they could make more money by replacing them with a more popular retailer or an entertainment option. "Everybody loves somebody that doesn't love them back," said Garrick Brown, Cushman & Wakefield's vice president of retail research for the Americas. For instance, a property owner that did a deal with Sears a few decades ago could be getting less than 50 cents a square foot annually in rent, Brown explained. If they divided that space into smaller tenants, they could potentially bring in retailers who would pay $40 to $50 a square foot, he said. An extreme example of this is General Growth Properties, which paid Sears north of $200 million to buy back space at the Ala Moana Center in Honolulu. GGP then redeveloped and expanded this space into a luxury wing that includes a Bloomingdale's. CBL & Associates, which owns a large quantity of malls with traditional anchor store tenants, has also redeveloped space vacated by Sears, J.C. Penney and Macy's over the years. One example is CoolSprings Galleria, near Nashville, Tennessee. As part of one of its projects, which cost roughly $50 million, it replaced a Sears with The Cheesecake Factory and brought in new tenants like H&M and Ulta. The return on that redevelopment was about 8 percent, and sales increases at the mall have been in the double digits since it opened roughly a year ago, CEO Stephen Lebovitz said. "It's a win-win because they're closing a store that's not very productive, and we're replacing it with someone that's going to be more successful," Lebovitz said. Macy's is exiting four of CBL's malls in this round of closures. At one of those properties, the real estate investment trust is finalizing negotiations with a new anchor store to replace Macy's. CBL will purchase the remaining three stores, currently owned by Macy's, for $5 million. Not all of these stories will have a happy ending. For the properties that stand to lose both a Sears and Macy's, these mass closures could be detrimental to their future — especially if they don't have the cash to redevelop the space, Brown said. They can also trigger co-tenancy clauses that allow smaller tenants to exit their leases, or get rent concessions. Many struggling centers in the U.S. are owned by small property owners, after the large REITs sold them off in a flight to quality centers. According to real estate research firm Green Street Advisors, there are more than 320 malls with quality grades of Cs or Ds that are at risk of closing or becoming irrelevant retail destinations. One mall that was on both Sears' and Macy's latest closures list is the Shenango Valley Mall, in Hermitage, Pennsylvania. The general manager of that property did not immediately respond to CNBC's request for comment as for what it will do to fill the space.

Malls will be hit the hardest

The saturated U.S. retail industry has been in a state of consolidation over the past few years, as companies attempt to reverse the aftermath of overexpansion. This growth spurt intensified right before the recession, when retailers and property owners were in a rush to do deals. But as online and discount shopping grab a larger chunk of consumer spending — and certain markets no longer serve as many shoppers — retailers have realized that they don't need as many physical locations. That realization comes as many of their 10-year leases are coming up for renewal, threatening a wave of store closures in a tight time frame. They also put at risk the industry's record occupancy rate, which Green Street says sits near 95 percent. "I expect the closures to be worse, and I expect the malls to be hit more than any other shopping center type," Cushman & Wakefield's Brown said. His firm keeps a list of the major store closures announced each year. Until 2016, the highest number it had tracked was in 2010, when about 3,000 closings were announced. That number grew to 4,000 last year, and Brown predicts it will balloon to 5,000 this year. "There's no way around [it]," Brown said, referring to what he considers an inevitable drop in the occupancy rate this year. While many argue that turnover and other changes have always been a part of the retail industry, "the pace at which it's changing is more rapid than has ever been the case," Green Street's Sullivan said. (UPDATE: This story was updated to include new information from CoStar.)

WATCH: Amazon tests its first drone delivery and it took 13 minutes