Thanos explained during a conversation with Doctor Strange
When Thanos was explaining his past to Doctor Strange on Titan, he said that the re-balancing of the universe should occur by random selection of people to be eliminated.
As the article asks, this raises later issues & other questions such as..
However, if this selection was random, why did the original Avengers just happen to survive?
Also, the disintegration seemed to affect Spider-Man differently than everyone else. While everyone else simply faded from existence instantaneously, Spider-Man seems to have felt the effects. He knew that he was disappearing and it took him a lot longer to fade away than the rest of the world.
Was this simply a way to show an emotional moment between him and Stark, or was there another reason as to why Spider-Man was affected differently?