Wheel alignment is part of standard automobile maintenance that consists of adjusting the angles of the wheels so that they are set to the car maker's specification. The purpose of these adjustments is to reduce tire wear, and to ensure that vehicle travel is straight and true (without "pulling" to one side or the other). Alignment angles can also be altered beyond the maker's specifications to obtain a specific handling characteristic. Motorsport and off-road applications may call for angles to be adjusted well beyond "normal" for a variety of reasons.
Under normal driving conditions many vehicles can go 40,000+ miles before they need a new set of tires which is a good interval to have the alignment checked as well. Any severe driving incidents or changes in suspension components would also warrant checking a vehicle's alignment.
The typical alignment on an economy sedan takes about an hour under ideal circumstances. A utility or performance vehicle may require additional labor. When fasteners and hardware are rusted/seized, extra time may be required and/or parts may need to be replaced.
In the same fashion that you will quickly wear out your shoes if you walk only on the inside or outside edge, so your tires may become worn if the wheel alignment is not within allowed specifications.
Changing rims and tires will normally not affect the alignment, although it may affect secondary angles.