Or How does Firefox determine where the password/username goes?
If I change name, id, title, class of an input element Firefox keeps filling it with password or email.>
Are those the only two elements on the form? Firefox is likely storing the structure of the form (two input boxes, one flagged as normal, one flagged as password) and filling in saved information without respect to the ID of the input elements.
Try this: add an extra input element to the form and see what happens. Either Firefox will not fill in anything, or you'll find your name in the first field and the password field filled in, while the second input element is blank.