Could a contentious election affect a peaceful transition of power

What history has shown us about contested elections and peaceful transitions of power.