The National Hockey League and the National Basketball Association both do it. It's how home field advantage is chosen in the other rounds of the MLB playoffs, and it makes some logical sense. Why not award the AL club that wins 98 games and the NL squad that wins 92 games? In fact, that happened in 2014 when the Houston Astros defeated the Baltimore Orioles to win the World Series.
It's calculated by taking the percentage of games played at home and multiplying it by two. So if a team plays 70% of its games at home, then it gets home field advantage.
In the NBA, teams that qualify for the playoffs are seeded based on their record. The team with the best record receives a bye into the second round. If these were football teams, they would be given an automatic spot in the next round. But since there is only one game per night, they must make do with what they've got.
In the NHL, each team gets one home game per week during the regular season. This can be any day of the year but most often takes place on Tuesday or Wednesday nights because those are the least busy days of the week for most hockey leagues. The team that finishes with the best record gets this privilege.
There is no specific reason why home ice advantage is important in baseball or basketball.
The higher-seeded club will bat first in Games 1 and 2 (and, if required, Games 6 and 7) at Globe Life Field. If both the AL and NL pennant winners have the same seed, the team with the greater regular-season winning percentage receives home-field advantage. If they are tied in that measure, then the following rules apply: The team that wins the most division titles advances to the postseason.
A division title is worth one game toward determining home field advantage, while a league championship is worth two games. In other words, if these were the final standings of the AL East: Boston Red Sox 90 wins, New York Yankees 88 wins -- both with equal record against division opponents -- then because the Red Sox won the division title, they would receive the top seed by default since there are no more tiebreakers needed to determine the number one seed.
If the AL and NL champions had the same record but didn't meet during the season, then the team that wins the most playoff games over the course of a seven-game series would be awarded home field advantage. For example, let's say the Chicago Cubs beat the San FranciscoGiants in the NLCS: Game 1 would be played in Chicago, with the Cubs holding home field advantage; if the series went six games, then Games 3 and 4 would be played in San Francisco.
The MLB All-Star Game does not decide home-field advantage in the World Series. Thankfully, the MLB All-Star Game is no longer a game with any meaningful importance. The regulation was ultimately amended in 2017 to give home-field advantage to the club with the greater regular season record.
In fact, the last time that the All-Star Game resulted in a change of possession was 1999. The National League had a 3-1 lead over the American League in the ninth inning before Alfonso Soriano hit a three-run homer off of Greg Maddux to win it for the AL.
Since then, both leagues have voted en masse to give their respective winners the benefit of the doubt. In addition, the updated format now has each team with the same number of wins playing one another in one semifinal and the winner advancing to face the league leader in the final.
So, yes, the All-Star Game does affect who gets to play at home in the playoffs but not which team wins the division or league championship.
In the first two rounds of the playoffs, a wild-card club must give up home-field advantage. However, in the World Series, home-field advantage is established independently of wild-card status. Prior to 2003, it was chosen by rotating between the American and National Leagues each year.
Since its introduction in 1994, 12 teams have made the postseason as a wild card - 10 from the National League and 2 from the American League. Of these 12 teams, 5 have won the World Series - 4 straight from 1997 to 2000 and then again in 2012 and 2013. The other 5 winners included 2 pennant races (1906, 1910) and 2 split series (1999, 2005).
The wild card has helped bring attention to small markets who might not otherwise receive much notice. For example, the Tampa Bay Rays qualified for their first playoff game in 2011 despite having the 26th highest payroll in baseball. In fact, they had one of the lowest-paid managers in Joe Manganiello who made $500,000.
Another benefit of the wild card is that it gives clubs an opportunity to prove themselves on the national stage before their traditional opening week. For example, the Arizona Diamondbacks used 2010's wild card as a springboard to win the NL West title the following season. They also went on to make the World Series for the first time in their history.