A Pilum (plural pila) was a javelin thrown by Roman Legionnaires to disrupt an enemy line moments before closing for hand-to-hand contact.
The pilum was about 6 or 6 1/2 feet long, weighing between 2 and 5 pounds (heavier early in Roman era, lighter later). There was an iron shaft at the front which was about a quarter inch diameter and about 2 feet long. A wood pole, 4 feet long or so was attached to the metal shaft. The wood added plenty of mass to the pilum giving it good penetration capacity. A point on the base of the pilum made it usable to stack with other pila in camp or plant in the ground for an ad hoc defense from cavalry.
A hard triangular tip was designed to punch through armor. With enough force it could penetrate a shield.
With the shaft narrower than the tip, if the pilum did penetrate a shield it would easily continue on and transfer any remaining force to the soldier behind the shield, possibly bruising him but better yet penetrating the armor. If a pilum punched through the armor, it would keep going deep into the enemy’s body.
If the pilum didn’t penetrate a shield, it would at least stick in the wood. The heavy weight would make the shield unusable until the javelin was removed. Since the Roman soldiers would be rushing forward ready to swing their gladi, a soldier with extra weight on the shield would have to abandon the shield and thus face the legionnaire without a shield.
The downside of a javelin is if it misses there is a good chance of having it returned to you by air with a moment of your enemy’s effort. An intentional or unintentional consequence of the design (take your pick whether designed that way) is the shaft made of softer metal tended to bend on impact. That made it unusable until the shaft could be hammered back straight. Other writers suggest one of the two metal rivets holding the shaft might either be weakened or replaced with a dowel of wood so the iron shaft would break off from the wood shaft on impact. Whether intentionally breaking or unintendedly bending, the pila would not be coming back at the legionnaires in the next few minutes after being thrown.
Legionnaires would drag around two pila for years until forming up in a shoulder-to-shoulder formation. Moments before the two lines of soldiers made contact, the Roman centurions would order a simultaneous launch of the pila. The mass shower of javelins was intended to break up the formation, wounding as many enemy as possible immediately before contact. A large number of wounded soldiers or ones without a shield would leave a formation disorganized and destabilized at the moment the legionnaires got within sword reach.
In a marching camp, the soldiers would drop off their pila at the perimeter of the camp with the the pila incorporated as a defensive tool at the top of the newly-built dirt rampart. With 4,800 soldiers in a legion times 2 pila each that makes 9,600 sharp points surrounding the camp sticking out at anyone foolish enough to try rushing the camp.
Pilum article at Wikipedia and Roman Soldier Operations Manual: Daily Life * Fighting Tactics * Weapons * Equipment * Kit by Simon Forty provided much of the above information. Other books I’ve read provide the same information.
Wikipedia article says experimental archaeology has indicated pilum would penetrate armor and could penetrate a shield. Their maximum range is about 100 feet with an effective range of about 50 to 70 feet.
In the late third century the pilum was replaced with a shorter javelin useful for thrusting. These were better able to deal with increasing number of cavalry on the field. That is also why the spatha (long sword) started to replace the shorter gladius (sword).
Plumbata, weighted darts, started to be used in the 4th century. The Operations Manual mentioned earlier says a soldier could carry three of these attached to the inside of the shield. Seems these would obviously not have the same penetrating power of a pilum, but would be easier to carry and would still create sufficient havoc if all were launched moments before contact.
For more discussion of a Roman soldiers’ kit, check out Equipment of a Roman Legionnaire.