With the recent Pfizer and Moderna and AstraZeneca and J&J vaccine rollouts, it looks like we're nearing the end of the COVID-19 pandemic. That said, lots of vaccines that we take for granted today weren't invented until decades after the Spanish Flu (eg., Polio), and I doubt scientists in 1918 were able to collaborate on the scale we have today in order to create a vaccine for a brand-new virus in the span of a year. So, what led to the end of the 1918 Spanish Flu pandemic?
Very slowly. Short answer-everyone died or developed antibodies.
The Spanish Flu did not in fact originate in Spain and the deadly outbreak was largely a result of World War I. More Americans died from the Spanish Flu than died in WWI. None of the countries involved in World War I would openly admit to the burgeoning threat posed by this flu-they didn't want to admit to more loss of life since superiority in World War I was largely based on who had the largest standing army. Both the Allied and Central powers of WWI limited their coverage of this new Spanish Flu and downplayed the threat. The political aftermath of World War I led to biased reporting among much of the worldwide media. Here in the U.S. many people thought reporting on the Spanish Flu was a violation of the Sedition Act of 1918 which (among other things) sought to prevent unfavorable language and any negative action towards the war. At the time America certainly did not report on the Spanish Flu accurately.
The reason it's been named the Spanish Flu was due to the fact Spain was not involved in World War I and they were the only nation that reported on this new outbreak in their media. Since they had no such Sedition Act, Spain had nothing to hide and reported their deaths. Since national media in Spain focused on this epidemic it was referred to as the Spanish Flu worldwide.
The King of Spain at the time, Alfonso the XIII contracted the Spanish Flu but survived.
The shortest answer to your question is everyone infected with the Spanish Flu either died or developed antibodies. The influenza virus wasn't isolated and understood until 1933. They did not have the benefit of modern vaccines or a worldwide closure with stay-at-home mandates. This would have been completely impossible at the time and most cases of Spanish Flu went unreported. We didn't fully understand the Spanish Flu until quite recently. It wasn't until 2008 that scientists fully understood what made the Spanish Flu epidemic so deadly. Scientists identified three particular genes which enabled the virus to weaken people's bronchial tubes and lungs and led to bacterial pneumonia. This would have gone unnoticed at the time and it took over 100 years for us to fully comprehend the reason the Spanish Flu was able to kill so much of the worldwide population.
No flu epidemic before or since has claimed as many lives as Spanish Flu. It is the second deadliest plague in human history; second only to the original Plague (i.e. The Bubonic Plague a.k.a. The Black Death).