"Trying and failing" is almost exactly what it means literally: trying, or attempting to do something, but not doing well in the attempt.
Example: I tried and failed to do well in my Math test. (take note that this phrase is 'tried AND failed', not 'tried but failed')
For the phrase: "Like the evening before, he had the beach mostly to himself", let us split it into two. "He had the beach mostly to himself" means there were very few people on the beach, including the man himself. "Like the evening before" lets us know that there were also very few people on the beach last night.
The phrase "have something to oneself" means occupying or enjoying something or even somebody without having to share it with others. For example, "I have the swimming pool [all] to myself" means you're the only person occupying or using the swimming pool. The 'all' is usually added for emphasis.
It could also be used for food or other items that people would normally enjoy. For instance, "John had the cake [all] to himself", which means John is the only person enjoying the cake and doesn't have to share it.
You can also say you have somebody all to yourself. For example, "After her brother went off to college, Christine finally had her mother all to herself." This phrase doesn't mean you own the person. Rather, it means the person's attention is entirely focused on you. This phrase may be considered rude depending on the situation due to the objectification of a person, as in, you treat somebody like an object.