To connect a Magic Mouse 2 or a Magic Trackpad 2 to your Mac you simply have to connect the device to the computer and wait for the latter to complete the configuration. If you're using an older wireless mouse or trackpad, you'll need to turn on Bluetooth connectivity and manually pair with your computer.
Steps
Method 1 of 2: Connect a Magic Mouse 2 or a Magic Trackpad 2

Step 1. Connect the mouse to the Mac using the appropriate Lightning to USB cable
Plug the Lightning connector into the communication port on your mouse, then plug the other end of the cable into a USB port on your Mac.

Step 2. Turn on the mouse using the mouse switch on the bottom of the pointing device
You will see a small green light come on, indicating that the mouse is active.

Step 3. Wait for the pairing procedure to run automatically
The Mac will perform the mouse setup by itself.

Step 4. Let the mouse battery fully charge
While the device is connected to the Mac via the Lightning cable the internal battery will be recharged automatically. When it's finished charging, disconnect it from your computer.
The Magic Mouse 2 cannot be used while connected to the Mac via the cable
Method 2 of 2: Connect a Magic Mouse or Magic Trackpad

Step 1. Click the Bluetooth icon visible on the right side of the Mac menu bar
If the option indicated is not present, access the "System Preferences" window, choose the "Bluetooth" item and press the "Activate" button.

Step 2. Select the Enable Bluetooth option

Step 3. Turn on the wireless mouse or trackpad
Use the switch located directly on the device to perform this step.

Step 4. Enter the "Apple" menu

Step 5. Select the System Preferences option

Step 6. Click the "Mouse" icon
If the latter is not present, press the "Show all" button located at the top of the "System Preferences" window.

Step 7. Press the Set Up Bluetooth Mouse button

Step 8. Press the Continue button after selecting the new mouse

Step 9. Choose the Pair option if prompted
This item should only appear in the case of an older Bluetooth mouse.

Step 10. Click the red Exit button once the device is successfully paired with the Mac
You are now able to use the mouse as usual.