Rails placed using the setblock command will only be oriented by the specified dataValue if there is already a rail at the specified coordinates. Otherwise, it will orient the rail such that it connects to adjacent rails, or if there are none, it will always place the north_south variant.
To reproduce, use this command in an open space:
/setblock ~1 ~ ~ minecraft:rail 9 replace
This will place a straight section of rail north/south. Without moving, use the command again, and the rail will change into the desired type: a curved section facing north/east.
If positioned so that the rail will be placed next to another rail, both rails will change shape in order to connect.
Linked issues
is duplicated by
relates to
Comments

Confirmed for
1.8.2-pre1 Note that this works if at the spot where you want to place a rail is already a rail (workaround)
Please reopen because of Searge's Comment

Testing in 1.8.2-pre6, replacing an existing rail with setblock will respect the provided dataValue. However, if there isn't already a rail in the specified block, it will always place the north_south (0) shape.

Confirmed for
15w37a
Confirmed for 15w43c.
Confirmed for 15w44a.
Sorry, but that would, as far as I know, be a feature request, not a bug...