To increase the magnetic intensity of a simple electromagnet, we can include a long closely wounded helical coil. This creates a solenoid. As the electromagnet is a temporary magnet, when the current is passed through the solenoid coils it behaves like a magnet, and it de-magnetizes as soon the current is removed.
The magnetic field in the solenoid is the vector sum of the magnetic fields due to current through individual turns of the solenoid. The magnetic fields associated with each single turn almost concentric circles and hence tend to cancel between the turns. At the interior mid-point, the field is strong and along the axis of the solenoid.
In simple words for a point P, the field due to the upper part of the solenoid turns tends to cancel the field due to the lower part of the solenoid turns, acting in opposite directions. Hence the field outside the solenoid is nearly zero.
Further by introducing the core of ferromagnetic material such as iron, we can increase the magnetic field produced by the solenoid. Due to high magnetic permeability of the iron or ferromagnetic materials, the magnetic field produced by the solenoid will be further increased by more than a thousand times the field produced.