He was trying to undermine the confidence of the Ferrari pit crew which he succeeded in doing.
If that forced the Ferrari team to pull in their race car for an unscheduled stop in order to check the car for a missing nut then all the better.
I don't recall that they actually did pull the car in for an inspection. IRL, a closer examination of the nut would have shown that it was an American SAE thread and not a European metric thread. An experienced mechanic such as those in the pit crew should have been able to determine that just by looking; the thread pitches are noticeably different. Likewise, simply fitting a wrench to the nut in question should have shown it to be imperial (e.g. ⁵∕₈, ¹¹∕₁₆, ³∕₄ inch, etc) and not metric (e.g. 16, 18, 20 mm, etc).
The Ferrari pit team argue amongst themselves after finding a loose nut in their pit area. Carroll Shelby seems amused in the background (camera right).