If bosses are defeated with a last hit, but they deal a hit on you causing your death at the same time, that boss could potentially not be considered defeated and can respawn.
Since this detail technically makes over half of the bosses skippable with ridiculous grinding, it is not taken into account when considering a boss 'optional' or not.
Defeating them grants you access to further areas, gives you special items such as Keys, and drops Boss Souls that can be used to acquire Boss Soul Weapons. List of all 32 bosses available in Dark Souls 2, and the bosses encountered in the additional DLC content.