Remove the rust on the nail head
First you need to remove the rust on your nails with sandpaper, aerosol lubricant or a wire brush. Remember to sand away all rust present on the nail head and the surrounding painted area.
Aerosol lubricants like WD-40 can also be used on the rusted nails in order to remove the rust.
Use nail punch to countersink the rusted nail
Next you need to countersink the nail which is rusted. By this way, the nail head will go below the surface. It should be almost 1/8 inch below the surface of your flooring.
Apply caulk to cover the nail
After countersinking the nail, use any caulk to cover the space between nail and the surface. Leave the caulking component for a while so that it solidifies. This will take few minutes depending on the type of component used.
After the caulking compound solidifies, cover the area with paint. Remember to use two coats over the area.
Scrape off rust with sandpaper
For unused nails, you need to ward off rust from the nail. Sandpaper or wire brush can be used to accomplish this task. Sandpapers are mainly used to scrape off rust from nail shaft while wire brush can easily remove rust from nail head.
Apply aerosol lubricants on the unused nails
You can ward off rust from nails by applying oil based lubricants e.g. WD-40 on them. First you need to spray the aerosol lubricant on the nails and then wipe it plus rust from them.
Immerse nails in Coca-Cola or soda
Dip rusted nails in a glass of Coca-Cola or other sodas and leave for few minutes. These sodas have chemicals which may remove all of rust. Take out the nails after few minutes and wipe them.