When you travel to another place, or spend some time at a friend's house, it's a visit. You should visit your grandmother! It's been a while since she's had a visit from you.
Whenever you spend a temporary amount of time with another person or in another place, that's a visit — whether it's your visit to San Francisco or your visit to the doctor for a checkup. In some parts of the U.S., visit is also a name for a chat: "I had a nice visit with your Aunt Sylvia yesterday." And if you pay a visit to someone, you go see them for a while.