I have out-of-date experience of working in this field, but I thought it might be useful to give an answer based on what I was doing approximately 10 years ago just to give background to any other answers that might describe more modern techniques.
At the time, giving a long form text as input to a neural network (which I suspect will be the modern approach) would have required a lot more processing power/memory than my employer was willing to dedicate to the task, so we worked on a different approach. We used a variety of well-known analytical algorithms (all of which were at the time implemented by the Stanford "CoreNLP" library) to tag the text with a variety of useful annotations, identifying proper nouns, references between the same object in different parts of the text, and so on. We then applied scores to each sentence and to the words within the sentence based on bonuses and penalties calculated from (eg) whether the sentence introduces a named object that is referred to again, or based on its position in the document or paragraph, and so on.
We then found the most highly ranking sentences and produced the summary based on those, deleting low-ranking words within the sentences (typically adjectives and adverbs that were not mentioned again). Some of the scores had to be recalculated each time a new sentence was added to the output (e.g. there was a bonus for the sentences in the same paragraph as a sentence that was included).
The values of the scores and penalties were optimized using a genetic algorithm in order to attempt to replicate a training set of hand-produced summaries.
The results were not brilliant, but the algorithm did produce meaningful summaries in most cases, although I believe my employer (I was hired as a freelancer to implement this system which was designed by the employer) never launched his planned commercial service based on the system.