What is the difference between doujinshi and manga? Doujinshi seem to represent usually works of amateurs, but that is a subjective measure. What is the objective difference between both works?
Doujinshi is closer to what we think of as "indie/self-published" comics compared to manga. Professionals can produce doujinshi as well as amateurs, and many mangaka will produce doujinshi on the side when they're otherwise unable to produce a certain work for legal reasons. 

Doujinshi are often, but not limited to:


Fanart of pre-existing intellectual properties
Ecchi material
One-shots


The quality of any given doujinshi can vary as a result, since literally anyone can produce a doujinshi without any sort of editorial oversight.