Under the Diversity Visa Program (DV Program) adminstered by the Department of State, up to 50,000 immigrant visas per year can be issued to those drawn from random selection (lottery) among all entries from countries with low rates of immigration to the U.S. To check if your home country is eligible, please visit: http://travel.state.gov/content/visas/english/immigrate/diversity-visa/entry.html.
After being selected as a visa lottery winner, you must apply for and obtain an immigrant visa (or must adust status if you are already in the U.S. in lawful non-immigrant status) in order to become a permanent resident. In order to apply for an immigrant visa or adjustment of status, immigrant visas must be available for your region/country for that month, which information is updated on the Department of State's monthly visa bulletin fount at: http://travel.state.gov/content/visas/english/law-and-policy/bulletin.html.
If you are already in the U.S. in lawful non-immigrant status, your adjustment of status process must be completed by September 30 of the fiscal year the lottery pertains to. Visas cannot be carried over to the next fiscal year.