How to determine from the formula that there is a phenyl group present in the molecule?
It's a matter of convention.

$\ce{C6H5}$ is conventionally used to represent phenyl because it is a common moiety. Your long, highly unsaturated, chain is also $\ce{C6H5}$, but it wouldn't conventionally be written like that without expansion, unless you're setting out to confuse someone.