The system will automatically generate id columns whenever a new row is inserted and an id column is not supplied. When an id value is supplied the system does not check to see that it is indeed the next id in sequence, nor does it update the sequence number to be automatically supplied the next time a row is inserted without an id column. Should an id value be manually supplied, it may be necessary to update the internal id counter so that future system generated ids will not conflict with an id already used.
See the Postgresql documentation section on sequence functions for reference material on the requisite PostgreSQL functions.
Don't supply id values manually unless you know what your doing.
Automatically generated ids are not guaranteed to be contiguous.