Also in order to establish the level of diversity in the company, they need to count how many of each kind of person there is.
Everyone in their respective buckets, amirite?
Many companies ask the information optionally (https://www.thehrcfoundation.org/professional-resources/self...) in order to provide appropriate benefit plans, as LGBTQ individuals may have specific health concerns that non-LGBTQ people don't have.
Edit: that’s not to say all companies with large engineering departments filled with one kind of gender/race/sexuality are always bad. But it should be examined to ensure it isn’t a result of a legally vulnerable workplace.
No, they are just more willing to hire you for reasons other than your actual merits as an employee.