As noted in a comment, this is apparently the form for travel to Italy and not from Italy to Spain. That’s why it seems modelled after the Italian national ID card and the information it contains.
In case you still have to provide the information, “By” is the authority issuing the document, for example a municipality or embassy. Italian identity cards and the documents issued by many other countries mention it but it seems your Spanish ID card doesn’t. You could just write “Spain“ in that field.
“Resident“ is the place where you live or your address. I would just use the “lugar de domicilio” mentioned on your card.
This is highly unlikely to have any serious consequences, simply put something reasonable on the form.