Use the same disc and the same installation key, and the installer treats the second machine like any other.
The catch is licensing. Many games permit only one or two active installations, and some require an online activation step that will refuse a third. Deactivating the game on the old machine first, through the launcher or the client's account page, usually clears the way.
Where a digital client such as Steam is involved, you simply log into the same account on the new PC and install from your library — no key needed.