The candle is the spirit of the dead and the river is the journey to the spirit world. I'm assuming the paper lanterns are the same, with the candle the spirit of the dead and the air the journey. The boat and the lanterns are just a way to take the journey.
I looked it up. The lanterns were used in war for signalling, and they are used to wish for good luck and prosperity. Many make wishes and send the lanterns up. It's also thought to show people the right path to take. And in modern times, it just looks nice at a festival.