"Illegally" = "Against the law"
"Illicit" = "Against the law or something that is morally wrong"
Ex:
Illicit Affair
Having an affair is not against the law, but it is seen as morally bad, so we can use illicit.
Most of the time, however, you can use both of them without loosing any meaning.
Ex:
Illegally selling drugs
Illicitly selling drugs
Both mean the exact same thing.