Another algorithm crawls through Concept Net to find words which have some meaningful relationship with your query. The vectors of the words in your query are compared to a huge database of of pre-computed vectors to find similar words.
One such algorithm uses word embedding to convert words into many dimensional vectors which represent their meanings.
Related Words runs on several different algorithms which compete to get their results higher in the list.