Remember that the editors of journals are experts in their field and typically only get papers that are at least within the margins of their subject matter expertise. So:
Rule 1: If the paper is in an area you (=the editor) knows well, then you will also know all of the major players in the area and pick people from among your professional network as reviewers.
Rule 2: If you don't know the specific area well, ask around among your friends for the names of potential reviewers.
Rule 3: If you don't even know who to ask, go through the list of references at the end of the paper and try to identify the key papers; then use web searches to find out which of these key papers' authors are the key players. Contact them.
For 80% of papers, rules 1 and 2 are good enough.