Campaigns end when their timer runs out - you can check this countdown in the Alliance War tab.
To leave a campaign you'll need to pay a fee, in Alliance points if I remember correctly - in order to leave.
You could alternatively assign yourself a Guest campaign, meaning you can play in that camp until your original one ends.
You will however have some restrictions in a guest campaign.