If it is in the evening, you can say "have a good night", as a way to end a conversation. It is a friendly way to let someone know you are hoping they have a happy evening.
Another time you might use it, is if someone is going to sleep. Say for example, if your sister says she is going to sleep, you can tell her to have a good night.
No matter how you use it, it is a friendly gesture and is used mostly when you do not expect to see them for the rest of the evening.