Visiting people and pastoral visitation, in particular, are so easily considered to be activities that just happen and do not have to be thought about. But visitation does have to be considered and thought through. Primarily, you need to remember that your visit to the other person should be motivated by love. You are going to them to bless them. So a self-giving attitude should prevail.
One particular way in which you love them is in thoughtfully considering how long you stay with them. This requires great sensitivity. If you leave someone too quickly then that person may feel that they have just had a perfunctory uncaring visit. However, if you stay too long then you can exhaust the person even grossly inconvenience them. So thoughtfulness is very important. Being aware of the health condition and general strength of the person is also very important. There are no doubt cultural sensitivities which need to be considered as well.
One guide to always have in your mind is to leave while you are still welcome. It is better to leave too early rather than too late.