If you have an older car and a headlight goes out, you have to replace the whole unit. This is called a sealed beam headlight. Usually there is a retaining ring that holds it in place. You have to remove that, replace the lamp, and then replace the ring. Pull up fairly close to a wall and turn the headlights on so you can see if it is aimed correctly. There are adjusting screws to set the horizontal and vertical direction.
More modern cars have a headlight construction that just requires changing the bulb. For these, you open the hood and do the whole process from the inside. You can get a new bulb one of two ways. Go to the auto parts store before you begin and look it up. They have a book that will tell you exactly which bulb you need. The other option is to remove the old bulb and then go get a new one. The book is pretty reliable but if you want to be certain, either write down the info on the underside of the bulb assembly or just take it with you to the parts store.
Some models have a cover in back of the headlight that must be removed. There may be a wiring harness that has to be moved out of the way. With any of these things, be very gentle. Everything is plastic and easily breakable. If there is a metal clip, pull it off. Try not to drop it. If it hits the ground it can be very hard to locate.
The plug that contains the bulb can be removed by just pulling it out. You may need to turn it slightly. Again, be gentle. Once you have the old bulb out, just plug in the new one. The base of the bulb should have a tab that matches with a slot in the socket. Seat it firmly, lock it into place, replace any retaining clips you may have removed, test it, and you are done. You just saved yourself several dollars by doing it yourself.
One thing you must be careful about: do not touch the new bulb with your fingers. You may contaminate it and greatly shorten its working life. When you open the box the new bulb came in, it just seems natural to grab the bulb and pull it out of the box. If you do that with your bare hand, you may have just negated all your efforts. Use gloves or at least a paper towel.