A smaller aspect ratio (i.e. 40 vs 45) will give you a smaller overall diameter, as well as a smaller sidewall.
Advantages:
better acceleration (smaller diameter, also lighter tire)
more contact patch, usually the tread width is a bit wider than a "45"
stiffer sidewall
lower Center of Gravity (CG) = better grip and a cheap way to lower your ride
possibly better grip (?) in cormers due to smaller sidewall, bigger contact patch, and lower CG
looks? (for some...)
Disadvantages:
faster speedo
higher RPM at cruisin' speed (more fuel consumption)
lower top speed
generally higher price per tire (most 215/40/17 are more expensive than 215/45/17)
less sidewall to absorb bumps and potholes, rims are less protected
harsher ride
looks? (for some...)