After the connection is lost, Clans of Clans algorithm finishes the fight with the troops you deployed. If you did it right, you might actually win the battle and gain loot.
In order to increase your chances of winning even if you got disconnected, you have to choose a relatively weak village so that your troops can take it out on their own without your intervention. See why connection is sometimes lost during an attack.
Create 2-3 healer units then deploy them behind your strong units. Even after the connection is lost, the healers will make sure your troops will survive for a long period of time.
The first thing you want to do is to get rid of the castle troops so that they don't defeat your troops after the connection is lost. See How to defeat Clan castle troops.
As soon as the weak connection sign appears, you have a few seconds to deploy your troops. The troops you deploy during those seconds will join the battle and won't get lost. Deploy all of your troops immediately after seeing this sign. See also how to make a successful attack.
Deploy units with high hit points, such as giants, and then use the healers to keep them alive for a long period of time. Once the defenses start attacking them you can, deploy the archers, wizards and the other weak units.
Since your strategy will depend on using healers to survive for the longest possible period of time, you need to play your full army as far away as you can from air defenses.
If you can take out an air defense in the first few seconds of the battle, your chances of keeping your army for a long period of time will become higher. See also how to protect your resources.
After the connection is back, check your attack log to find out how much loot you gained and whether you won the battle.