Use your mouse. Buy troops first, then position them and fight the battle. You can also buy new units during battles if you have enough money.
Workers and farms are used for building up your economy, but farms can also be attacked, so they'll need some protection.