Question

Why? (what are the products after each reaction)? I know that
waterand acid should hydrolize the CN groups and the ester, but
Idont get why the molecules join together, and why one carbon
islost (decarbxoylation?)