Before you apply to register your trademark, the first (and most important) question to answer is who will own it. Ownership of copyright in the code and ownership of trademark rights in the name and logo won’t necessarily be the same.
Unlike copyright in the code, community members are not co-owners of the trademark rights in the name or logo; rather, the trademark rights will be owned by a person or entity capable of owning property.
Additionally, only the owner of the name may file for registration, so this question must be answered before applying.
There is further complexity if you have a logo. In that case, the person who designed the logo may own the copyright rights in the logo but not the trademark rights.
To avoid problems that might arise around logo ownership, the owner of the copyright in the logo should assign the copyright to the owner of the trademark rights.
Assuming that a member of the project creates the trademark, you can consider the following approaches:
The person who created the name remains the owner of the trademark (Linus Torvalds, for instance) or transfers the rights to another (the QGIS project for instance);
A group of people, acting as partners or an unincorporated association, owns the trademark;
The person who created the name transfers rights to to the community, embodied by an umbrella organization, society or non-profit corporation;
The person who created the name does not bother with this issue at all — as it was (and is) the case in the Arduino project, but the consequences of such an approach are likely to be problematic.
If you transfer your rights to another person or entity, you will need to meet the legal conditions for the form of transfer in the respective jurisdiction—a written document is always best. Trademark registration and renewal fees are not cheap, so if you use an umbrella organization, society or non-profit you will have to decide who will cover the costs.
Why it is best to outline an approach in this area? Because potential clashes, like Hudson and Jenkins, might be avoided. The owner of a trademark can revoke the right of the project to use the trademark if the project no longer represents what the owner intended the project to be, as happened to the Jenkins project.