In general, no. It may seem like it makes sense to put your router somewhere in the attic that’s more centrally located, but there are several issues with that.
First of all the router’s performance is going to be impacted negatively by the ceiling itself and any insulation that’s there. In a best case scenario you’re going to lose about 50% of the broadcast power of your router and probably more than that. If the router is designed with built-in antennas, it’s probably designed to radiate its broadcast power from the top and sides, not the bottom as you would want if you placed it in the attic. If you turn the router upside down, it could affect its cooling, which leads to…
the second reason, which is that the extreme temperatures in your attic are probably beyond what your router is designed for, meaning it’s likely to fail a lot sooner. It’s just an all-around bad idea, and the good thing is that there’s a better solution.
Ubiquiti’s UAP-series access points are designed to be ceiling-mounted. You run the cable through the attic and drill through the ceiling with the template provided so you can mount the access point on the ceiling. One cable carries power and signal using the power-over-ethernet technology built into the access point. You have a lot of flexibility when installing this sort of system and Ubiquiti’s software makes it easy to customize the system to allow guests to log in and to maximize the power use. It’s really a better choice than putting the router in an attic.