To be able to use the Wii Remote while playing Wii or Wii U, you first need to sync it with the console. You can easily figure out how if your friend brings their own Wii remote when they visit to play. You can also sync your Wii Remote with your computer for use with the Dolphin emulator.
Step
Method 1 of 3: Syncing with Wii

Step 1. Turn on the Wii and make sure the Wii is not running any programs

Step 2. Remove the back cover of the Wii Remote

Step 3. Flip the SD card cover on the front of the Wii
If you're using a Mini Wii, the Sync button is on the left side of the console, near the battery slot.

Step 4. Press and release the Sync button on the back of the Wii Remote
This button is under the battery compartment. The LED light on the Wii Remote will start flashing.

Step 5. Quickly press and release the Sync button on the Wii when the Wii Remote light flashes

Step 6. Wait for the light to stop flashing
If the Wii Remote light stays on, the Remote synced successfully.
Solve the problem

Step 1. Make sure no other programs are running
Your Wii may not be able to sync if there are games playing on the channel. Make sure you're in the Wii's main menu while the sync process is taking place.
Remove all game discs completely from the system if you still can't sync your Wii

Step 2. Make sure the Wii Remote has enough battery
The Wii Remote uses AA batteries, and may not sync unless the battery is low. Try changing to a different battery, and see if the Wii Remote can now sync.

Step 3. Unplug the power cord from the back of the Wii and wait for about 20 seconds
Then plug the cable back in and turn it on. The Wii will reset and solve your problem.

Step 4. Ensure that the sensor bar is placed above or below the TV
The sensor bar is the Wii Remote's way of being able to point at whatever's on the screen. The sensor bar will work best when it is above or below the TV.

Step 5. Reset the Wii Remote by removing the battery, waiting a minute, reinserting the battery, then syncing it again
Method 2 of 3: Syncing with Wii U

Step 1. Turn on the Wii U and make sure the main menu is showing
If you try to start Wii Mode without syncing it with the Wii Remote, you will be prompted for it

Step 2. Press and hold the Sync button on the front of the Wii U until the Sync screen appears

Step 3. Remove the back cover of the Wii Remote

Step 4. Press the Sync button on the back of the Wii Remote
This button is under the battery. The LED on the Wii Remote will start flashing, then stay on indicating a good connection.
Solve the problem

Step 1. Make sure no other programs are running
The Wii U may not be able to sync if there are games playing on the channel. Make sure you are in the main menu of the Wii U while the sync process is taking place.

Step 2. Make sure the Wii Remote has enough battery
The Wii Remote uses AA batteries, and may not sync unless the battery is low. Try switching to a different battery, and see if the Wii Remote can now sync.

Step 3. Make sure the sensor bar is placed above or below the TV
The sensor bar is the Wii Remote's way of being able to point at whatever's on the screen. The sensor bar will work best when it is above or below the TV.
Method 3 of 3: Syncing with Windows PC

Step 1. Use a USB Bluetooth dongle if your computer does not have a built-in Bluetooth adapter
The Wii Remote can be connected to a computer using Bluetooth, so you can use your Wii Remote in the Dolphin emulator or other programs.
You'll need to re-install the Wii Remote each time your computer restarts

Step 2. Right-click the Bluetooth icon in the system tray, then select Add a device

Step 3. Press the "1" and "2" buttons on the Wii Remote at the same time so that the lights start flashing

Step 4. Select "Nintendo RVL-CNT-01" from the list of devices, then click
Next.

Step 5. Select Pair without using a code and click
Next.

Step 6. Wait for the Wii Remote to pair with the computer

Step 7. Open Dolphin and click on the Wiimote button

Step 8. Select Real Wiimote from the Input Source menu
This is useful so that you can use the Wii remote while playing games via the emulator.

Step 9. Get the sensor bar for the computer
Use a battery-powered sensor bar, or make your own.
Solve the problem

Step 1. Close Dolphin before you sync it with the Wii Remote
If you sync while Dolphin is open, there's a good chance the Wii Remote won't appear in the controller's selection menu. Close Dolphin, unpair the Wii Remote by right-clicking in the Bluetooth menu and selecting Remove device, then try pairing again.