How to lubricate a buzzing fan?
WD-40 is a penetrating oil and corrosion preventative. As a lubricant, it is quite short term as it tends to evaporate.

And the lubrication type for an electric motor depends on the type of bearing.

Ball bearings require grease. Flush the bearing with solvent to clean out the old gunk and pack with a light bearing grease.

Oilite style sleeve bearings require oil with a viscosity in the SAE 10 to SAE 30 weight range. You can find what you need as Sewing Machine Oil or Supco Turbine Oil.

And if it's a regular muffin fan motor, I'd just replace it with a quality ball bearing fan. They come in common sizes and thicknesses. They often used plastic sleeve bearings and once the bearings have started to howl, the holes in them have gone oval shaped and it's an exercise in futility to make it go away by oiling.