In order to preload the game, head to the Nintendo Switch eShop and open the store page for the game you want. Both Shield and Sword are fundamentally the same game, but there are minor differences, including some Pokémon only being available in one of the games. You need to prepurchase the game, so you will have to pay for it before you can begin to preload it.
Once you have prepurchased it, it will give you the option to preload it right away. Just click on the button to begin downloading it, and everything will go automatically from here on out. Once its finished downloading, it will show up on your game library, but cannot be opened until November 15 when it is the official release day.
Each game takes up about 10GB of storage space.