Somebody opens the front door and says one word. Somebody still inside answers with another, and the whole exchange is over before the door shuts. It happens in the opening minutes of more anime than you could count — and no subtitle has ever really translated it.
They are not goodbyes. They are promises.
いってきます is two verbs stuck together: いって (go) and きます (come back). Literally: “I'll go and come back.” That's the whole idea — you are not saying farewell, you are telling the people staying that you intend to return.
And the answer comes straight back: いってらっしゃい — “go and come back”, said to you. The pair is the point. One person promises, the other one holds them to it.
The other half of the day
Coming home works the same way. ただいま is short for ただいま かえりました — “I've returned, just now.” The reply is おかえり (おかえりなさい if you want it politer), which is simply “welcome back.” Nobody decides whether to say them; they arrive automatically, like a light switching on.

いってきます!
I'm off!

いってらっしゃい。
See you when you're back.
So when do you say さようなら?
Almost never at home. さようなら carries a weight English “goodbye” lost centuries ago — it leans towards “we may not meet again”, which is why anime saves it for the sad episode. Leaving the house, you want いってきます. Leaving the office, じゃあ、おさきに しつれいします. Leaving your friends, じゃあね or またね.
