How and why political parties change and adapt