This can be done either by capturing the butterfly, taking a picture of it, or recognizing it. There are many online resources that can help you quickly identify butterfly species by color pattern.
The most comprehensive website for North American butterflies is Butterflies of America. This site reviews butterflies by family and contains photographs of live adults, pinned specimens, immatures, habitat, larval hostplants, and bibliographies.
At the same time, if you're not terribly familiar with butterflies nor understand the basic appearance and differences of these 7 butterfly families, you may want to check out these resources that show a comprehensive list of butterfly species by thumbnails; so that you can quickly scan these images to find your species of butterfly.