Whois is a tool which provides you a lot of valuable information about any domain. Including who registered it and when, when was it last renewed, in which country was it registered, but you can even get contact information of the administrator of the domain.
If you are interested in a domain that is already taken, you can do one of two things: wait until the registration expires or try to buy it from its owner. In the former case you can use Whois to know when it was last renewed - can you count on it expiring soon and acquiring it.
In the former case you can immediately contact the owner or at least the registrar and make your offer right away.
Whois will help you in purchasing domains, but it will also assist you in avoiding or closing legal feuds (about copyright infringement for example).