Hummingbirds get their sustenance from spiders and other small bugs, but they get their fuel to catch those bugs from nectar. You can provide this nectar to hummingbirds by either planting a hummingbird garden, or by placing a hummingbird feeder in your yard. Feeders are obviously a much simpler way of attracting hummingbirds, and you can also place them in front of a window to watch or photograph.
There are two basic shapes of feeders, one is the inverted bottle shape, and the other is the basin shape. Either one will do just fine for feeding, but the basin one is usually easier to clean. And it's very important to clean your feeder every few days.
Another thing to consider is whether or not to get a feeder with a perch. It takes a lot of energy, and in turn burns lots of calories, for a hummingbird to suspend itself while eating. Also, if you get a perch, your visitor is likely to stick around much longer, hummingbirds actually spend 80% of their time perching so they're likely t enjoy the break.
Placing one near a garden might be the quickest way to attract hummingbirds, but they're likely to show up anyway if you place them in a different location. Some caution against placing them near a window, for fear that the bird might crash into the glass, but you can remedy this by having blinds or curtains behind the window, or by placing a decoration somewhere right outside of the window.
If you really want to keep the birds around, you might even place something that will attract bugs, like overripe fruit, near the feeder. This way the bird can get fuel as well as nourishment.