How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d
2D textures usually aren't addressed in terms like the "nth element". The whole point of a 2D texture is that you want to access it using 2D coordinates. If you want to send a 1D array to the shader I'd use a 1D texture.
That being said, you can compute it by something like this:
(This assumes you already know how to set up a sampler parameter in the shader and bind a texture to it from the application side.)