What you are discovering is the behavior of dipoles in non-uniform fields. Your permanent magnet is a magnetic dipole (having two poles, north and south) and the solenoid creates the strong field inside the space within the coil.
In order to think about what should happen, let's pretend that magnetic monopoles exist, that is, isolated north and south poles [note]. Magnetic monopoles in magnetic fields act just like electric charges (or, electric monopoles) in electric fields. Positive magnetic monopoles (north poles) feel a force in the direction of magnetic fields, and negative magnetic monopoles (south poles) feel a force in the opposite direction of magnetic fields. Now, a dipole is like a north and south monopole of equal strength attached to each other with a small separation between them. Let's look at a dipole in a uniform field and see what happens. A uniform field is one that has the same magnetic field strength and direction at every point.
The blue tube is the dipole with its north end marked with + and its south end marked with -. The maroon arrows represent the magnetic field with uniformity indicated by the arrows being the same size. In this setup, the positive end feels the same force as the negative end. Since the two ends pull in opposite directions, the total force is zero and the dipole does not move. If the magnetic field in your solenoid was completely uniform, then there would be no pushing or pulling force on the permanent magnet. You would be able to place the permanent magnet anywhere within the tube and have it sit there not moving.
Now, let's look at a non-uniform field. A non-uniform field is one that varies in strength or direction at different locations.
The field still points to the right, but the field gets stronger to the right (shown by the arrow being larger). Since the north pole is to the right, it feels a stronger force than the south pole. The forces no longer balance, and the dipole is pulled to the right (indicated by the blue arrow). If the field to the left was stronger, then the south pole would feel the stronger force and the dipole would be pulled to the left.
Judging by your description of your experiment, I'm going to guess that the field strength inside the solenoid looks something like this:
Outside the solenoid, the field rapidly drops to zero. Inside, the field always points
in the same direction, but with varying strength. In the plot above, the field is always positive, which I will say means pointing to the right. The larger the value on the plot, the stronger the field points to the right. Now, let's insert the dipole from the left side.
Just like with the simpler picture above, the positive/north end of the dipole is in a stronger field, so the dipole is pulled to the right because the pull to the left on the negative/south end is weaker. Let's push the dipole in farther.
Now, the negative/south end of the dipole feels the stronger field, so the leftward force overcomes the rightward force on the positive/north end. The dipole is pulled to the left. So, where the magnetic field is strongest is a stable equilibrium point inside the solenoid. This corresponds to position 2 in your photograph. By the same reasoning, the other peak on the right will also be a stable equilibrium position and would correspond to position 3 in your photograph.
Since the field is symmetrical, it seems like is should be possible to get the magnet to sit in the middle of the solenoid, right? Let's see what happens when the dipole is flipped so the poles face the opposite way.
Using the same reasoning, we see that the positive/north end sees a stronger field and feels a stronger force than the negative/south end, so the force is to the right. Similarly, the force points the opposite way on the other side of the trough.
Now, the negative/south pole sees a stronger field and feels a stronger force, so the dipole is pushed to the left. The minimum field in the middle is now a stable equilibrium.
If I'm correct, I would predict that getting the permanent magnet to rest in the middle of the solenoid requires flipping the magnet's orientation to the opposite of that when it rests in positions 2 and 3 (if you can prevent the magnet from rotating, see question 6 below).
Questions to ask yourself:
- What is the shape of the field in your shorter solenoid?
- Why is there only one equilibrium point?
- What happens when you flip the permanent magnet and attempt to place it inside the short solenoid?
- Why do opposite poles of permanent magnets attract?
- What happens to a solenoid when it is not aligned with the field? Try inserting the permanent magnet into the solenoid so that its poles are perpendicular to the solenoid field. Explain what happens in terms of the 2-monopole model of the dipole.
- At the end of my answer, I said that the middle of the solenoid can be an equilibrium position by flipping the permanent magnet. Is this a stable equilibrium?
- Pick a position within the solenoid and try to wrap the wire around the spool in such a way that a permanent magnet will be attracted to that position no matter where it starts within the spool.
[note] No magnetic monopole has ever been found in any experiment. They are just a useful model that is both simple and predictive of experiments.