From New Delhi to Rome, governments face a new kind of battlefield where hashtags replace tanks and algorithms shape political destiny