Germany’s far-right AfD failed to secure enough seats to form a majority to govern, according to preliminary results.