I know the question might seem a bit elementary but i was was curious whether there is a particular reason behind the way hydrogens are represented in a hydrocarbon chain. Is there a difference between representing them with straight lines or with slant lines as in the two images? Is one preferred over the other? If so under which conditions?
Ok, so this is somehow relevant.
Including the hydrogens is just another way of writing those structures down, usually used in teaching for people who are new to the subject. In case of ethane and ethene it also makes sense, since just an isolated line or a double line is kind of strange, just like you won't make just a point for methane.
It doesn't matter if the lines are all in 90° angles or not, so why do it? Well, in most cases we do 2D drawings of 3D objects and we somehow want to give an accurate picture. So in the alkane drawing this somehow represents the tetrahedral array of the four atoms around each carbon better than the structure on the bottom. For the alkene, this one is actually a flat molecule with pretty much those angles inbetween all atoms, so that's a pretty good representation of the actual molecule, which is why this is the best way to do it in this case.
There is no real difference. Sometimes this comes about from the drawing software people use or personal preference. In some texts the authors or typesetters are using LaTeX packages to draw organic molecules, this can be rather tedious and it is easier to use 90° angles.
The angled hydrogens are a bit closer to what a 2d drawing of the 3d object would look like, but not to the point where any information is conveyed. It can make visualizing the compound in 3 dimensions a bit easier for me when they are drawn this way.
For the double bonds the cis/trans or E/Z information is conveyed, although this is irrelevant in your example.
The way you draw molecules depends on the purpose of the drawing.
If all you are trying to convey is the connectivity of the molecules (which atoms are connected to which other atoms) then it matters little whether you draw the molecule withe right angled bonds or slanted bonds. In older books you often see white complex structures described in ugly ways the were determined by the needs of typesetting from fixed character symbols. So benzene was not drawn as an regular hexagon but as a "stretched" hexagon which was easier to typeset. But chemists got the essential information anyway. Now that we create images electronically and have better tools most books draw the hexagons as they really are as regular hexagons: it looks better but doesn't add any extra information to an experienced chemist.
It is the same with simple hydrocarbons in most cases. The choice, if connectivity is all that matters is aesthetic, not an essential part of conveying information.
However, if you are trying to show something important about the actual shape of the molecule (perhaps because you are describing a reaction mechanism where the configuration of the molecule matters, then it is important to convey something about the relevant part of the structure. Real molecules are (usually) 3-dimensional and bond angles around carbon are not right angles. So chemists draw them with something approximating the right angles and may add extra clues (like wedges and dotted lines) to clarify their 3-D orientation. This is sometimes important, but not always.
So whether the way you draw a molecule is important or not depends on the purpose of the drawing.
But it is also true that now we have good tools that make drawing slanted bonds rather than right-angled ones, there is little reason not to do so. It isn't always essential, but why not do something that requires no extra effort and looks better?