I am making a vanity complete with mirror and light bars on each side of the mirror. I am attaching the light bars to an extension cord as a source of electricity, but I noticed that the light bar came with an extra grounding wire. How should I do this if the extension only has the hot and neutral wires? Do I need to do anything with it?
Making this with out grounding, or for you to do it at all with your level of electrical knowledge is a Bad idea. Vanity usually implies "in a bathroom", and that implies "near water". Outlets within (usually 1.5 meter, depending on your local electrical code) or a sink must have Ground Fault protection. Switches may not be within the same distance of a shower or sink.
Even if your creation is not in a bathroom, extension cords are not intended for part of the permanent wiring of an appliance, and anything in which a light bulb can be replaced (thereby exposing the contacts) should be grounded and wired correctly (neutral to the shell, hot wire to the center contact, if a traditional screw in bulb).
There are many certifications required for factory made electrical appliances before they may be turned loose upon the public. They exist for reasons. The fact that you even have to ask your questions indicates that you are creating a potentially unsafe device.
Please at least put your project aside while you read up on basic electricity, electrical code, and safety.
It's probably not legal to hook up a bathroom light via cordage. (I'm not 100% sure of that, because in some cases, luminaires are allowed to use cordage in permanent installations.) Nonetheless, your AHJ (city inspector) gets the final call, and he will certainly say "nope" unless you are there with a copy of the Electrical Code ready to quote chapter and verse.
Well, if you're going to do cordage, do it right.
You have an appliance which requires grounding. That means in order to get its UL listing, it needed a ground. That means if you're going to put it on cordage, you will need to use a 3-wire cord with a ground wire. I buy mine at McMaster-Carr, but as you know, you can also lop an extension cord. Extension cords do have the advantage of being made out of cordage, a special type of electrical cable made for use as a flexible cord.
You are clearly thinking "Well ground isn't really necessary because the light works without ground". That is true. However, the value of grounding to public safety has been proven pretty definitely by thousands of accident investigations. Not lightly do they ask for it.