Solenoids are magnetic devices that uses an electromagnet to move another device. Automotive starters use solenoids to move the starter gear to engage the flywheel to start the engine. Solenoids are also used to open and close valves as well as turn switches on and off. These devices are also used in robot designs and construction. Wiring a 12-volt solenoid is not terribly complicated. The key is paying close attention to the solenoid's polarity. Solenoids are designed to move in only one direction.
Look at the solenoid and identify the connection points. The manufacturer's information supplied with the solenoid should identify the terminals on the solenoid. Solenoids usually have a positive and a negative terminal. These are the two connection points. For a solenoid to operate correctly, the polarity must be correct.
Connect the 12-volt power lines to the solenoid terminals in the correct polarity. This is done by connecting the black, negative wire of the power source to the negative terminal of the solenoid. Then connect the white, positive wire of the control switch to the positive terminal of the solenoid. The control switch wire could be a different colour than white. The control switch is used to complete the connection between the positive terminal of the power source and the positive terminal of the solenoid. Depending on what the solenoid controls, the control switch may be different. For example, if the solenoid controls a car starter, then the control switch is the car ignition switch. If the solenoid controls a fan or air conditioner clutch, then the control switch is the AC control inside the car.
Turn on the control switch or ignition switch and observe the action of the solenoid. Some indication of motion should be seen or heard when the switch is activated. For a car starter solenoid, the solenoid will click once and the engine should try to start. For a fan solenoid, the fan should come on and for an AC solenoid, the AC clutch should engage and begin to spin.