While you are an F-1 student, you may travel home or visit other countries and return to the US to resume your studies. Normally, you must return to the US within five months of departure in order to maintain your F-1 status. If you must be away longer, consult the International Student office.
You will need to have a valid passport, visa, and a current, signed I-20 in order to re-enter the US.
A US visa has no validity for travel to other countries, so if you will visit or study in a country besides your home country, you must check with that country's embassy or consulate for the visa requirements appropriate for your citizenship. These may be different from requirements for American students or other international students who have traveled to that country, so never rely on word of mouth!
Travel during OPT (after graduation) may require special attention. Please consult the ICE website (below) and the International Student office for advice.
ICE, the US agency which oversees immigration and customs, publishes a fact sheet on travel and re-entry for F-1 students. Consult it for the most up-to-date information on travel and re-entry to the US.